aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.cpp')
-rw-r--r--src/Utils.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 2a36d27..7ed6574 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -85,4 +85,25 @@ namespace QuickMedia {
qm_enable_touch_set = true;
return qm_enable_touch;
}
+
+ time_t iso_utc_to_unix_time(const char *time_str) {
+ int year = 0;
+ int month = 0;
+ int day = 0;
+ int hour = 0;
+ int minute = 0;
+ int second = 0;
+ sscanf(time_str, "%d-%d-%dT%d:%d:%d", &year, &month, &day, &hour, &minute, &second);
+ if(year == 0) return 0;
+
+ struct tm time;
+ memset(&time, 0, sizeof(time));
+ time.tm_year = year - 1900;
+ time.tm_mon = month - 1;
+ time.tm_mday = day;
+ time.tm_hour = hour;
+ time.tm_min = minute;
+ time.tm_sec = second;
+ return timegm(&time);
+ }
} \ No newline at end of file