Hey, When you print the current time from boot(8) it can look kinda dumb, especially if you have a single-digit day *and* a single-digit hour/minute/second, e.g.:
boot> time Tue May 8 5:3:2 2018 libsa's printf supports zero- and space-padded output, though, so it's easy to make libsa's ctime look more like libc's ctime: boot> time Tue May 8 05:03:02 2018 ^ much more "normal". libsa's ctime is used nowhere but boot(8). ok? -- Scott Cheloha Index: sys/lib/libsa/ctime.c =================================================================== RCS file: /cvs/src/sys/lib/libsa/ctime.c,v retrieving revision 1.5 diff -u -p -r1.5 ctime.c --- sys/lib/libsa/ctime.c 11 Aug 2003 06:23:09 -0000 1.5 +++ sys/lib/libsa/ctime.c 22 May 2018 18:11:00 -0000 @@ -66,8 +66,7 @@ ctime(const time_t *clock) if (month > 2 && isleap(year)) tt--; - /* no field widths in printf() */ - snprintf(buf, sizeof buf, "%s %s %d %d:%d:%d %d\n", + snprintf(buf, sizeof buf, "%s %s%3d %02d:%02d:%02d %d\n", ((wday < 0 || wday >= 7)? "???": wdays[wday]), ((month < 0 || month >= 12)? "???": months[month]), (int)tt, hh, mm, ss, year);