[Toybox] [PATCH] date: more test cleanup.
rob at landley.net
Thu Feb 14 06:07:23 PST 2019
On 2/14/19 6:53 AM, Rob Landley wrote:
> Ok, US/Arizona timezone, no daylight savings time... and the racy %a fetch is
> fetching _today's_ weekday and not the one for June 2. And nontrivial uses of it
> are basically just comparing the date output against _itself_ which may not
> prove anything...
Dumb little script to print out the day of the year:
# Arguments YEAR-1900 MM DD
# Leap year
[ $2 -gt 2 ] && [ $(($Y%4)) -eq 0 ] &&
[ $(($Y%400)) -eq 0 -o $(($Y%100)) -ne 0 ] && $X=$(($X-1))
dayo $1 $2 $3
Unfortunately, when I tried to systematically test it, I went "there's a day of
the year field, I'll just feed that and a year into date and have it spit out of
the month and day...
$ ./date -D %j -d 1
Sun Jan 0 00:00:00 CST 1900
Does not do what I want. Of course neither does:
$ busybox date -D %j -d 1
Thu Feb 14 00:00:00 CST 2019
Alas, localtime considers weekday and day of the year to be generated fields,
with year/month/day what they're generated _from_...
More information about the Toybox