diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-12-11 12:04:41 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-01-07 08:45:12 +0100 |
commit | 6eb5d78419299d01f500140dd9400a68725e142b (patch) | |
tree | 08740da960aa8f512689a3924c986af6af37cf4d /commands | |
parent | a9e7e68279de3aec38b038211a15a80cfc612c4e (diff) | |
download | barebox-6eb5d78419299d01f500140dd9400a68725e142b.tar.gz barebox-6eb5d78419299d01f500140dd9400a68725e142b.tar.xz |
hwclock command: use format like the Linux tool does
Print three-letter abbreviations of the days and months.
With a fixup by Andrey Smirnov:
| common/date.c: Fix off-by-one error
|
| As per http://pubs.opengroup.org/onlinepubs/007908775/xsh/time.h.html
| 'tm_wday' is zero indexed with zero representing Sunday, this is also
| corroborated by the code in rtc_time_to_tm() which used 4 to represent
| Thursday.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/hwclock.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/commands/hwclock.c b/commands/hwclock.c index a1f5293122..49569a99c2 100644 --- a/commands/hwclock.c +++ b/commands/hwclock.c @@ -138,9 +138,7 @@ static int do_hwclock(int argc, char *argv[]) snprintf(t, 12, "%lu", time); setenv(env_name, t); } else { - printf("%02d:%02d:%02d %02d-%02d-%04d\n", - tm.tm_hour, tm.tm_min, tm.tm_sec, - tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900); + printf("%s\n", time_str(&tm)); } return 0; |