libc: use timegm instead of mktime

By using `mktime()`, which assumes local time, we render the `TZ`
environment variable ineffective. Instead, `timegm()` should be used to
set the real-time clock to UTC.

genodelabs/genode#5074
This commit is contained in:
Johannes Schlatow 2023-12-06 15:05:40 +01:00 committed by Norman Feske
parent b80fd10a70
commit c1bc9f8557

View File

@ -55,7 +55,7 @@ struct Libc::Rtc : Vfs::Watch_response_handler
struct tm tm { };
if (strptime(buf, "%Y-%m-%d %H:%M:%S", &tm)
|| strptime(buf, "%Y-%m-%d %H:%M", &tm)) {
_rtc_value = mktime(&tm);
_rtc_value = timegm(&tm);
if (_rtc_value == (time_t)-1)
_rtc_value = 0;
}