| Deutsch English Français Italiano |
|
<v4fe2g$3su2t$1@i2pn2.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.misty.com!weretis.net!feeder9.news.weretis.net!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail
From: Stefan Claas <pollux@tilde.club>
Newsgroups: sci.crypt
Subject: Re: [OT] Unix Time Stamp - Independence Day 2025 :-)
Date: Thu, 13 Jun 2024 20:33:51 +0200
Organization: i2pn2 (i2pn.org)
Message-ID: <v4fe2g$3su2t$1@i2pn2.org>
References: <v49m0j$3m1d4$1@i2pn2.org>
<bg0aO.416$CPG7.345@fx03.ams4>
<v4a9ej$172l3$1@dont-email.me>
<RykaO.11758$ujOb.8153@fx16.ams4>
<v4craa$3preo$1@i2pn2.org>
<qsGaO.27099$CPG7.681@fx03.ams4>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 13 Jun 2024 18:33:53 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="4094045"; mail-complaints-to="usenet@i2pn2.org";
posting-account="uWi4uQdALkj7ETOfPbhNXfz0+Ra/gM5z6/Fa40dJi9U";
Finger: tilde.club/~pollux/
X-Spam-Checker-Version: SpamAssassin 4.0.0
Bytes: 46493
Lines: 1266
Cri-Cri wrote:
> On Wed, 12 Jun 2024 21:01:30 +0200, Stefan Claas wrote:
>
> > My program works on fifty different platforms and I am currently working
> > to include all timezones, besides +0000 UTC. :-)
>
> Does that include BCE? :)
>
> Only Gregorian or Julian also? How about Mayan? :)
>
No ... but here is a bash script, written by Bing AI, which
allows you to enter with -h hex values, or with -d decimal
values and prints to stdout all timezones. :-)
#!/bin/bash
# Assume the time is in decimal format by default
time_format="decimal"
# Check if arguments were passed
while getopts ":d:h:" opt; do
case $opt in
d)
epoch_time=$OPTARG
;;
h)
epoch_time=$((16#$OPTARG))
time_format="hex"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
# Use the current time if no time was passed
if [ -z "$epoch_time" ]; then
epoch_time=$(date +%s)
fi
# Print the table header
printf "%-40s %s\n" "Timezone" "Local Time"
echo "---------------------------------------------------------------------"
# Write all available timezones to a file
timedatectl list-timezones > timezones.txt
# Output the local time for the passed Unix Epoch Time in each timezone
while IFS= read -r timezone
do
local_time=$(TZ=$timezone date -d "@$epoch_time" '+%a %b %d %Y %H:%M:%S %Z')
printf "%-40s %s\n" "$timezone" "$local_time"
done < timezones.txt
And here a sample run:
./tz.sh -h 68686868 > data.txt
data.txt:Timezone Local Time
---------------------------------------------------------------------
Africa/Abidjan Fri Jul 04 2025 23:48:56 GMT
Africa/Accra Fri Jul 04 2025 23:48:56 GMT
Africa/Addis_Ababa Sat Jul 05 2025 02:48:56 EAT
Africa/Algiers Sat Jul 05 2025 00:48:56 CET
Africa/Asmara Sat Jul 05 2025 02:48:56 EAT
Africa/Asmera Sat Jul 05 2025 02:48:56 EAT
Africa/Bamako Fri Jul 04 2025 23:48:56 GMT
Africa/Bangui Sat Jul 05 2025 00:48:56 WAT
Africa/Banjul Fri Jul 04 2025 23:48:56 GMT
Africa/Bissau Fri Jul 04 2025 23:48:56 GMT
Africa/Blantyre Sat Jul 05 2025 01:48:56 CAT
Africa/Brazzaville Sat Jul 05 2025 00:48:56 WAT
Africa/Bujumbura Sat Jul 05 2025 01:48:56 CAT
Africa/Cairo Sat Jul 05 2025 02:48:56 EEST
Africa/Casablanca Sat Jul 05 2025 00:48:56 +01
Africa/Ceuta Sat Jul 05 2025 01:48:56 CEST
Africa/Conakry Fri Jul 04 2025 23:48:56 GMT
Africa/Dakar Fri Jul 04 2025 23:48:56 GMT
Africa/Dar_es_Salaam Sat Jul 05 2025 02:48:56 EAT
Africa/Djibouti Sat Jul 05 2025 02:48:56 EAT
Africa/Douala Sat Jul 05 2025 00:48:56 WAT
Africa/El_Aaiun Sat Jul 05 2025 00:48:56 +01
Africa/Freetown Fri Jul 04 2025 23:48:56 GMT
Africa/Gaborone Sat Jul 05 2025 01:48:56 CAT
Africa/Harare Sat Jul 05 2025 01:48:56 CAT
Africa/Johannesburg Sat Jul 05 2025 01:48:56 SAST
Africa/Juba Sat Jul 05 2025 01:48:56 CAT
Africa/Kampala Sat Jul 05 2025 02:48:56 EAT
Africa/Khartoum Sat Jul 05 2025 01:48:56 CAT
Africa/Kigali Sat Jul 05 2025 01:48:56 CAT
Africa/Kinshasa Sat Jul 05 2025 00:48:56 WAT
Africa/Lagos Sat Jul 05 2025 00:48:56 WAT
Africa/Libreville Sat Jul 05 2025 00:48:56 WAT
Africa/Lome Fri Jul 04 2025 23:48:56 GMT
Africa/Luanda Sat Jul 05 2025 00:48:56 WAT
Africa/Lubumbashi Sat Jul 05 2025 01:48:56 CAT
Africa/Lusaka Sat Jul 05 2025 01:48:56 CAT
Africa/Malabo Sat Jul 05 2025 00:48:56 WAT
Africa/Maputo Sat Jul 05 2025 01:48:56 CAT
Africa/Maseru Sat Jul 05 2025 01:48:56 SAST
Africa/Mbabane Sat Jul 05 2025 01:48:56 SAST
Africa/Mogadishu Sat Jul 05 2025 02:48:56 EAT
Africa/Monrovia Fri Jul 04 2025 23:48:56 GMT
Africa/Nairobi Sat Jul 05 2025 02:48:56 EAT
Africa/Ndjamena Sat Jul 05 2025 00:48:56 WAT
Africa/Niamey Sat Jul 05 2025 00:48:56 WAT
Africa/Nouakchott Fri Jul 04 2025 23:48:56 GMT
Africa/Ouagadougou Fri Jul 04 2025 23:48:56 GMT
Africa/Porto-Novo Sat Jul 05 2025 00:48:56 WAT
Africa/Sao_Tome Fri Jul 04 2025 23:48:56 GMT
Africa/Timbuktu Fri Jul 04 2025 23:48:56 GMT
Africa/Tripoli Sat Jul 05 2025 01:48:56 EET
Africa/Tunis Sat Jul 05 2025 00:48:56 CET
Africa/Windhoek Sat Jul 05 2025 01:48:56 CAT
========== REMAINDER OF ARTICLE TRUNCATED ==========