aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.cpp')
-rw-r--r--src/Utils.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 3da045e..c73932b 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -104,6 +104,7 @@ namespace QuickMedia {
int hour = 0;
int minute = 0;
int second = 0;
+ // TODO: Handle timezone
sscanf(time_str, "%d-%d-%dT%d:%d:%d", &year, &month, &day, &hour, &minute, &second);
if(year == 0) return 0;
@@ -117,4 +118,12 @@ namespace QuickMedia {
time.tm_sec = second;
return timegm(&time);
}
+
+ std::string unix_time_to_local_time_str(time_t unix_time) {
+ struct tm time_tm;
+ localtime_r(&unix_time, &time_tm);
+ char time_str[128] = {0};
+ strftime(time_str, sizeof(time_str) - 1, "%Y %b %d, %a %H:%M", &time_tm);
+ return time_str;
+ }
} \ No newline at end of file