diff options
Diffstat (limited to 'libcore')
| -rw-r--r-- | libcore/helpers.c | 13 | ||||
| -rw-r--r-- | libcore/helpers.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/libcore/helpers.c b/libcore/helpers.c index 9fb0bdf..e195c37 100644 --- a/libcore/helpers.c +++ b/libcore/helpers.c @@ -213,6 +213,19 @@ void cStopWatch::Stop(const char* message) { dsyslog("skindesigner: %s - needed %d ms", message, (int)(cTimeMs::Now() - start)); } +string GetTimeString(int seconds) { + time_t sec(seconds); + tm *p = gmtime(&sec); + int hours = p->tm_hour; + int mins = p->tm_min; + int secs = p->tm_sec; + if (hours > 0) { + return *cString::sprintf("%d:%02d:%02d", hours, mins, secs); + } + return *cString::sprintf("%02d:%02d", mins, secs);; +} + + //View Helpers string GetScreenResolutionString(int width, int height, bool *isHD) { string name = ""; diff --git a/libcore/helpers.h b/libcore/helpers.h index b370eb0..74ed7d3 100644 --- a/libcore/helpers.h +++ b/libcore/helpers.h @@ -41,6 +41,8 @@ public: void Stop(const char* message); }; +string GetTimeString(int seconds); + string GetScreenResolutionString(int width, int height, bool *isHD); string GetScreenAspectString(double aspect, bool *isWideScreen); |
