Userland: Make /bin/date pretty-print the date, too.

This commit is contained in:
Andreas Kling 2019-02-03 02:47:37 +01:00
parent 7e4376d469
commit e2f27aa7b5
Notes: sideshowbarker 2024-07-19 15:53:38 +09:00

View file

@ -5,8 +5,16 @@ int main(int argc, char** argv)
{
(void) argc;
(void) argv;
time_t now = time(nullptr);
printf("%u\n", now);
auto* tm = localtime(&now);
printf("%4u-%02u-%02u %02u:%02u:%02u\n",
tm->tm_year + 1900,
tm->tm_mon + 1,
tm->tm_mday,
tm->tm_hour,
tm->tm_min,
tm->tm_sec);
return 0;
}