Well, I decided to start a blog again. This is probably driven by my general distaste in Social Media trends. Or perhaps, I just need a place to ramble on. No idea. We will see where this goes, if anywhere. It is easy to start a blog, keeping it up to date... and interesting to anyone, including me, is the difficult part.
Why use Blogger? Sheer laziness. Managing such systems can be fun, but it interferes with the process of content creation.
No ads here.
We will see where this goes.
Here is a bit of code for you. This script takes a timestamp in date format, cleans it up a bit and presents conversions. I use it to communicate times to coworkers in multiple timezones. It is called zoc.awk.
% awk -f zoc.awk 0930
Mon 03 Nov 2025 09:30 EST/UTC-0500 (Mon 03/09:30 EST) (Mon 03/06:30 PST) (Mon 03/14:30 UTC) (1762180200 epoch) (Mon 03 @645 swatch)
The input string is the same syntax as the date command, with the same optional fields.
BEGIN {
# for (x in ARGV) {
# print x, ARGV[x];
# }
if (ARGV[1] == "") {
print "specify a valid 'date' string as ARGV[1]"
exit 1
}
cmd = "date -j " ARGV[1] " +\"%s\""
cmd | getline t
# print "T " t;
close(cmd)
if (t != "") {
printf "%s ", strftime("%a %d %b %Y %H:%M %Z/UTC%z", t)
ENVIRON["TZ"] = "US/Eastern"
printf "%s ", strftime("(%a %d/%H:%M %Z)", t)
ENVIRON["TZ"] = "US/Pacific"
printf "%s ", strftime("(%a %d/%H:%M %Z)", t)
ENVIRON["TZ"] = "UTC"
printf "%s ", strftime("(%a %d/%H:%M %Z)", t)
printf "%s ", strftime("(%s epoch)", t)
# UTC + one hour, modulo one day (86400) then div by 86.4 (100 beats per day)
sitRaw=(t+3600)%86400
sitRaw=sitRaw/86.4
sitDate=strftime("%a %d",t+3600);
printf("(%s @%03d swatch)",sitDate,sitRaw);
print ""
} else {
print "'date' parsing failed"
exit 1
}
}
No comments:
Post a Comment