diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-06-07 16:04:41 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-06-07 16:04:41 +0200 |
commit | a35a344697c4ccdda0a87960d058f8ede2bb2cd2 (patch) | |
tree | 682e251c57ba9079db54ee528dfa98e49f362782 /src/Utils.cpp | |
parent | b207d812582368fea47bf87becc645fbcaf07b61 (diff) |
Add uploaded time to mangadex chapter description
Diffstat (limited to 'src/Utils.cpp')
-rw-r--r-- | src/Utils.cpp | 9 |
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 |