aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-05-13 23:30:20 +0200
committerdec05eba <dec05eba@protonmail.com>2021-05-13 23:30:20 +0200
commitacb6ac0a04e800a79876908fd1fdb98dc7e93678 (patch)
treee8d0e97b3ac22d8ee1fc5b5a515047bf4a173014 /src/Utils.cpp
parent4af866c610a8f6650a5d2c5045c085d9af7d7951 (diff)
Show local time for nyaa.si, soundcloud and spotify. Add sukebei
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