exercism / awk

Exercism exercises in AWK.
https://exercism.org/tracks/awk
MIT License
18 stars 21 forks source link

gigaseconds instructions #217

Closed gregorybleiker closed 11 months ago

gregorybleiker commented 1 year ago

I think the exercise gigaseconds is missing a few important details.

glennj commented 1 year ago
gregorybleiker commented 1 year ago

Regardless of the discussion if tests are actually specs, for me personally it would have been clearer if the instructions to the exercise would have included that information. I'd be happy to make a PR.

Setting the UTC flag was not sufficient with my setup (manjaro on WSL). In either case (UTC flag set or unset), some tests failed. Only after setting the environment explicitly via TZ was it that all tests completed (this time with the UTC flag 0, because probably the local time was already interpreted as UTC).

glennj commented 1 year ago

I wonder if you're setting the DST flag in the datespec instead of setting the UTC flag in the function parameters.

gregorybleiker commented 11 months ago

@glennj I have tried all combinations (mktime with or without flag, datespec with or without DST). Any other suggestions? image

IsaacG commented 11 months ago

Exercism has a Discord server and forum which are a really good place to ask for exercise help!!

glennj commented 11 months ago

@gregorybleiker are you also using the UTC flag in your strftime call?

$ gawk 'BEGIN {date = "2023 7 30 12 34 56"
  start = mktime(date, 1)
  print strftime("%Y-%m-%d %H:%M:%S", start) # <<<
}'
2023-07-30 08:34:56
$ gawk 'BEGIN {date = "2023 7 30 12 34 56 0";
  start = mktime(date, 1)
  print strftime("%Y-%m-%d %H:%M:%S", start, 1) # <<<
}'
2023-07-30 12:34:56
gregorybleiker commented 11 months ago

@glennj that was it.