diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-08-14 14:09:12 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-15 12:20:38 +0200 |
commit | 3870f4160d1fc292e417e91889fcaa46401adebe (patch) | |
tree | 78a9d08cfbd28e906534ab716177f1971016d841 /Userland/Utilities/date.cpp | |
parent | 98408b8920e703979f8f0feb5fdc9e67a6de729e (diff) | |
download | serenity-3870f4160d1fc292e417e91889fcaa46401adebe.zip |
date: Use DateTime::now() for time, cleanup duplicate returns
Diffstat (limited to 'Userland/Utilities/date.cpp')
-rw-r--r-- | Userland/Utilities/date.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Userland/Utilities/date.cpp b/Userland/Utilities/date.cpp index 9a431098dd..965f70ae4e 100644 --- a/Userland/Utilities/date.cpp +++ b/Userland/Utilities/date.cpp @@ -56,23 +56,17 @@ int main(int argc, char** argv) return 1; } - time_t now = time(nullptr); - auto date = Core::DateTime::from_timestamp(now); - + auto date = Core::DateTime::now(); if (print_unix_date) { - outln("{}", (long long)now); - return 0; + outln("{}", date.timestamp()); } else if (print_iso_8601) { outln("{}", date.to_string("%Y-%m-%dT%H:%M:%S-00:00")); - return 0; } else if (print_rfc_5322) { outln("{}", date.to_string("%a, %d %b %Y %H:%M:%S -0000")); - return 0; } else if (print_rfc_3339) { outln("{}", date.to_string("%Y-%m-%d %H:%M:%S-00:00")); - return 0; } else { outln("{}", date.to_string()); - return 0; } + return 0; } |