From 55ec083a329ab2c8a53b665dbbe1168a5fcfcbad Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Sun, 26 Apr 2026 23:10:42 +0000 Subject: [PATCH] fix(user/bkdatev):Display UTC *and* right/UTC correctly - Note: UTC unix epoch is seconds since 1970-01-01 without leap seconds - Note: right/UTC unix epoch is seconds since 1970-01-01 *with* leap seconds. --- user/bkdatev | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/user/bkdatev b/user/bkdatev index 808ab9e..3ab8c3b 100755 --- a/user/bkdatev +++ b/user/bkdatev @@ -2,12 +2,12 @@ # Desc: Baltakatei's verbose date command # Usage: bkdatev [args] # Example: bkdatev --date="2001-09-11T09:02:59-04" -# Version: 1.0.1 +# Version: 1.0.2 # Depends: GNU Coreutils 8.32, Bash 3.2.57 # Ref/Attrib: [1] "ISO 8601". Wikipedia. https://en.wikipedia.org/wiki/ISO_8601 # [2] "Changing the Locale in Wine" https://stackoverflow.com/a/16428951 # [3] "Shanghai vs Beijing" https://bugs.launchpad.net/ubuntu/+source/libgweather/+bug/228554 -# [4] “"right" tz database (zoneinfo) files and GPS-based NTP” https://www.ucolick.org/~sla/leapsecs/right+gps.html +# [4] “Understanding the "right" time zone database” https://kenta.blogspot.com/2016/03/sqfzcxay-understanding-right-time-zone.html # Notes: * Check `ls -R /usr/share/zoneinfo` for time zone names. # * Check `cat /usr/share/i18n/SUPPORTED` for supported locales. # * For list of valid locales, see: https://manpages.ubuntu.com/manpages/bionic/man3/DateTime::Locale::Catalog.3pm.html @@ -144,9 +144,11 @@ main() { # UTC (pop. (2021): 7,837,000,000) ( - export TZ=right/UTC; # See [4] + export TZ=UTC; id="UTC"; - fs_3="+%s seconds since 1970-01-01T00:00+00"; + date_string="$(date -Is)"; + right_epoch="$(TZ=right/UTC date --date="$date_string" +%s;)"; # see [4] + fs_3="+%s seconds (${right_epoch} with leap seconds) since 1970-01-01T00:00+00"; print_dateline "$@"; ); line_sep; -- 2.39.5