diff options
author | Nico Weber <thakis@chromium.org> | 2020-08-24 10:01:14 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-24 18:21:16 +0200 |
commit | 697faba1470e2899555764d3c871e1324868d3a9 (patch) | |
tree | 82da093104c4a122b8919fcc794772d7974480dd | |
parent | 2191ec591f2c3cee00bf3c3e71adb17e970a0bc1 (diff) | |
download | serenity-697faba1470e2899555764d3c871e1324868d3a9.zip |
LibJS: Make Date.getUTCSeconds() call through to LibC
The tzset documentation says that TZ allows a per-second local timezone,
so don't be needlessly clever here.
No observable behavior difference at this point, but if we ever
implement tzset, this will have a small effect.
-rw-r--r-- | Libraries/LibJS/Runtime/Date.cpp | 5 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/Date.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/Libraries/LibJS/Runtime/Date.cpp b/Libraries/LibJS/Runtime/Date.cpp index 08858899ef..08eb3adaee 100644 --- a/Libraries/LibJS/Runtime/Date.cpp +++ b/Libraries/LibJS/Runtime/Date.cpp @@ -87,6 +87,11 @@ int Date::utc_month() const return to_utc_tm().tm_mon; } +int Date::utc_seconds() const +{ + return to_utc_tm().tm_sec; +} + String Date::iso_date_string() const { auto tm = to_utc_tm(); diff --git a/Libraries/LibJS/Runtime/Date.h b/Libraries/LibJS/Runtime/Date.h index b4d9370818..c1c0d160c1 100644 --- a/Libraries/LibJS/Runtime/Date.h +++ b/Libraries/LibJS/Runtime/Date.h @@ -61,7 +61,7 @@ public: int utc_milliseconds() const { return milliseconds(); } int utc_minutes() const; int utc_month() const; - int utc_seconds() const { return seconds(); } + int utc_seconds() const; String date_string() const { return m_datetime.to_string("%a %b %d %Y"); } // FIXME: Deal with timezones once SerenityOS has a working tzset(3) |