mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
date: Use DateTime::now() for time, cleanup duplicate returns
This commit is contained in:
parent
98408b8920
commit
3870f4160d
1 changed files with 3 additions and 9 deletions
|
@ -56,23 +56,17 @@ int main(int argc, char** argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t now = time(nullptr);
|
auto date = Core::DateTime::now();
|
||||||
auto date = Core::DateTime::from_timestamp(now);
|
|
||||||
|
|
||||||
if (print_unix_date) {
|
if (print_unix_date) {
|
||||||
outln("{}", (long long)now);
|
outln("{}", date.timestamp());
|
||||||
return 0;
|
|
||||||
} else if (print_iso_8601) {
|
} else if (print_iso_8601) {
|
||||||
outln("{}", date.to_string("%Y-%m-%dT%H:%M:%S-00:00"));
|
outln("{}", date.to_string("%Y-%m-%dT%H:%M:%S-00:00"));
|
||||||
return 0;
|
|
||||||
} else if (print_rfc_5322) {
|
} else if (print_rfc_5322) {
|
||||||
outln("{}", date.to_string("%a, %d %b %Y %H:%M:%S -0000"));
|
outln("{}", date.to_string("%a, %d %b %Y %H:%M:%S -0000"));
|
||||||
return 0;
|
|
||||||
} else if (print_rfc_3339) {
|
} else if (print_rfc_3339) {
|
||||||
outln("{}", date.to_string("%Y-%m-%d %H:%M:%S-00:00"));
|
outln("{}", date.to_string("%Y-%m-%d %H:%M:%S-00:00"));
|
||||||
return 0;
|
|
||||||
} else {
|
} else {
|
||||||
outln("{}", date.to_string());
|
outln("{}", date.to_string());
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue