Sunday, 20220918 13:38+0000, Florian Obser wrote:
I'm happy with that, let's do this then
- fix the offset calculation
- output tm->tm_zone in addition to TZ to be able to spot typos.

I like the overall diff (thanks!), but one minor formatting nit is that
I believe it's more common under ISO 8601[1] to print UTC timezone
offset as "+/-%H%M", e.g. "-0400", not as "-4h00". At least, that's
what I'm familiar with in SMTP headers.

Updated diff below, where only change from your latest diff is in the
second printw(3) statement. Tested against both TZ='America/New_York'
(-0400) and TZ='Asia/Kolkata' (+0530).

Again, thanks for polishing this old "game"!

[1] https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC


$ got diff
diff /cvs/src
commit - 5d6f1c4a07abcf6c1413059c603776d5dc6805aa
path + /cvs/src
blob - 66e5eee79e6449916e83660a8c7c62667d04c5ab
file + games/grdc/grdc.c
--- games/grdc/grdc.c
+++ games/grdc/grdc.c
@@ -185,9 +185,12 @@ main(int argc, char *argv[])
                                vline(ACS_VLINE, YDEPTH);

                                if (tz != NULL) {
+                                       int     h, m;
+                                       h = tm->tm_gmtoff / 3600;
+                                       m = abs((int)tm->tm_gmtoff % 3600 / 60);
                                        move(ybase - 1, xbase);
-                                       printw("[ %s %+d ]", tz,
-                                           tm->tm_gmtoff / 60 / 60 );
+                                       printw("[ %s (%s) %+2.2d%02d]", tz,
+                                           tm->tm_zone, h, m);
                                }

                                attrset(COLOR_PAIR(2));



Reply via email to