1 dt=`busybox date -d 1:2 +%T`
2 test x"$dt" = x"01:02:00"
4 dt=`busybox date -d 1:2:3 +%T`
5 test x"$dt" = x"01:02:03"
9 # date (GNU coreutils) 6.10 reports:
10 # date: invalid date '1.2-3:4'
11 # busybox 1.11.0.svn date reports:
12 # date: invalid date '1/2 3:4'
14 # TODO: (1) compare with strings, not "host date"
15 # (2) implement d/m[/y] hh:mm[:ss] fmt in date applet
16 #hdt=`$host_date -d '1/2 3:4'`
17 #dt=`busybox date -d 1.2-3:4`
18 #test x"$hdt" = x"$dt"
20 #hdt=`$host_date -d '1/2 3:4:5'`
21 #dt=`busybox date -d 1.2-3:4:5`
22 #test x"$hdt" = x"$dt"
24 #hdt=`$host_date -d '1/2/1999 3:4'`
25 #dt=`busybox date -d 1999.1.2-3:4`
26 #test x"$hdt" = x"$dt"
28 #hdt=`$host_date -d '1/2/1999 3:4:5'`
29 #dt=`busybox date -d 1999.1.2-3:4:5`
30 #test x"$hdt" = x"$dt"
32 hdt=`$host_date -d '1999-1-2 3:4:5'`
33 dt=`busybox date -d '1999-1-2 3:4:5'`
36 # Avoiding using week day in this evaluation, as it's mostly different every year
37 # date (GNU coreutils) 6.10 reports:
38 # date: invalid date '01231133'
39 dt=`busybox date -d 01231133 +%c`
40 dt=`echo "$dt" | cut -b5-19`
41 test x"$dt" = x"Jan 23 11:33:00"
43 # date (GNU coreutils) 6.10 reports:
44 # date: invalid date '012311332000'
45 dt=`busybox date -d 012311332000 +%c`
46 test x"$dt" = x"Sun Jan 23 11:33:00 2000"
48 # date (GNU coreutils) 6.10 reports:
49 # date: invalid date '012311332000'
50 dt=`busybox date -d 012311332000.30 +%c`
51 test x"$dt" = x"Sun Jan 23 11:33:30 2000"
53 lcbbd="LC_ALL=C busybox date"
54 wd=$(eval $lcbbd +%a) # weekday name
55 mn=$(eval $lcbbd +%b) # month name
56 dm=$(eval $lcbbd +%e) # day of month, space padded
57 h=$(eval $lcbbd +%H) # hour, zero padded
58 m=$(eval $lcbbd +%M) # minute, zero padded
59 s=$(eval $lcbbd +%S) # second, zero padded
60 z=$(eval $lcbbd -u +%Z) # time zone abbreviation
61 y=$(eval $lcbbd +%Y) # year
115 [ $dm -ge 1 ] && [ $dm -le 31 ] || res=BAD
117 [ $h -ge 0 ] && [ $h -le 23 ] || res=BAD
119 [ $m -ge 0 ] && [ $m -le 59 ] || res=BAD
121 [ $s -ge 0 ] && [ $s -le 59 ] || res=BAD
122 [ $z = UTC ] || res=BAD
123 [ $y -ge 1970 ] || res=BAD
127 # This should error out (by showing usage text). Testing for that
128 dt=`busybox date -d 012311332000.30 %+c 2>&1 | head -n 1`
129 test x"${dt#BusyBox * multi-call binary}" = x