On Wed, Dec 22, 2010 at 4:27 PM, Mark Guagenti <[email protected]> wrote: > For some reason the date command on my busybox (1.17.4) will not show > the correct day of the week. No matter what I set the date to it > always shows "Sunday" as the day of the week. For example: > # date -s "2010-12-21 08:24:00" > Sunday 21 08:24:00 MST 2010 > # date -s "2010-12-22 08:24:00" > t Sunday 22 08:24:00 MST 2010 > # date +%s > # date +%a > t > # date +%A > > I also tried setting the time with NTP but that doesn't seem to help. > Any suggestions on why my system is doing this?
Not really. I can't reproduce it. I disabled actual date setting code, and added printouts in validate_tm_time() around mktime(ptm) call: # ./busybox date -s "2010-12-21 08:24:00" date: before:sec:0 min:24 hour:8 mday:21 mon:11 year:110 wday:3 yday:355 isdst:-1 date: after:sec:0 min:24 hour:8 mday:21 mon:11 year:110 wday:2 yday:354 isdst:0 Tue Dec 21 08:24:00 CET 2010 # ./busybox date -s "2010-12-22 08:24:00" date: before:sec:0 min:24 hour:8 mday:22 mon:11 year:110 wday:3 yday:355 isdst:-1 date: after:sec:0 min:24 hour:8 mday:22 mon:11 year:110 wday:3 yday:355 isdst:0 Wed Dec 22 08:24:00 CET 2010 # ./busybox date -s "2010-12-23 08:24:00" date: before:sec:0 min:24 hour:8 mday:23 mon:11 year:110 wday:3 yday:355 isdst:-1 date: after:sec:0 min:24 hour:8 mday:23 mon:11 year:110 wday:4 yday:356 isdst:0 Thu Dec 23 08:24:00 CET 2010 Look how wday changes. As you see, mktime() sets wday according to other fields, as documented in its manpage: "The mktime() function converts a broken-down time structure, expressed as local time, to calendar time representation. The function ignores the specified contents of the structure members tm_wday and tm_yday and recomputes them from the other information in the broken-down time structure." Looks like you are using buggy libc. Which libc do you use? -- vda _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
