karm

karmutility.cpp
1#ifndef KARM_UTILITY_H
2#define KARM_UTILITY_H
3
4#include <stdlib.h>
5
6#include <tdeglobal.h>
7#include <tdelocale.h>
8#include "karmutility.h"
9
10TQString formatTime( long minutes, bool decimal )
11{
12 TQString time;
13 if ( decimal ) {
14 time.sprintf("%.2f", minutes / 60.0);
15 time.replace( '.', TDEGlobal::locale()->decimalSymbol() );
16 }
17 else time.sprintf("%s%ld:%02ld",
18 (minutes < 0) ? TDEGlobal::locale()->negativeSign().utf8().data() : "",
19 labs(minutes / 60), labs(minutes % 60));
20 return time;
21}
22
23#endif // KARM_UTILITY_H