3
0

date-timezone 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. # FEATURE: CONFIG_FEATURE_TIMEZONE
  2. # 'Z' is UTC
  3. dt=$(TZ=UTC0 busybox date -d '1999-1-2 3:4:5Z')
  4. dt=$(echo "$dt" | cut -b1-19)
  5. test x"$dt" = x"Sat Jan 2 03:04:05"
  6. # '+0600' is six hours ahead of UTC
  7. dt=$(TZ=UTC0 busybox date -d '1999-1-2 3:4:5 +0600')
  8. dt=$(echo "$dt" | cut -b1-19)
  9. test x"$dt" = x"Fri Jan 1 21:04:05"
  10. # '-0600' is six hours behind UTC
  11. dt=$(TZ=UTC0 busybox date -d '1999-1-2 3:4:5 -0600')
  12. dt=$(echo "$dt" | cut -b1-19)
  13. test x"$dt" = x"Sat Jan 2 09:04:05"
  14. # before dst is switched on
  15. dt=$(TZ=GMT0BST,M3.5.0/1,M10.5.0/2 busybox date -d '2021-03-28 00:59:59 +0000')
  16. test x"$dt" = x"Sun Mar 28 00:59:59 GMT 2021"
  17. # after dst is switched on
  18. dt=$(TZ=GMT0BST,M3.5.0/1,M10.5.0/2 busybox date -d '2021-03-28 01:00:01 +0000')
  19. test x"$dt" = x"Sun Mar 28 02:00:01 BST 2021"
  20. # before dst is switched off
  21. dt=$(TZ=GMT0BST,M3.5.0/1,M10.5.0/2 busybox date -d '2021-10-31 00:00:01 +0000')
  22. test x"$dt" = x"Sun Oct 31 01:00:01 BST 2021"
  23. # after dst is switched off: back to 01:00:01 but with different TZ
  24. dt=$(TZ=GMT0BST,M3.5.0/1,M10.5.0/2 busybox date -d '2021-10-31 01:00:01 +0000')
  25. test x"$dt" = x"Sun Oct 31 01:00:01 GMT 2021"