00001 #ifndef KARM_UTILITY_H
00002 #define KARM_UTILITY_H
00003
00004 #include <stdlib.h>
00005
00006 #include <tdeglobal.h>
00007 #include <tdelocale.h>
00008 #include "karmutility.h"
00009
00010 TQString formatTime( long minutes, bool decimal )
00011 {
00012 TQString time;
00013 if ( decimal ) {
00014 time.sprintf("%.2f", minutes / 60.0);
00015 time.replace( '.', TDEGlobal::locale()->decimalSymbol() );
00016 }
00017 else time.sprintf("%s%ld:%02ld",
00018 (minutes < 0) ? TDEGlobal::locale()->negativeSign().utf8().data() : "",
00019 labs(minutes / 60), labs(minutes % 60));
00020 return time;
00021 }
00022
00023 #endif // KARM_UTILITY_H