scripts/treno: bypass timezone insanity
This commit is contained in:
parent
512ad2f5c1
commit
e15df3b70f
@ -118,18 +118,9 @@ EOF
|
|||||||
def green($x): "\u001B[1;32m\($x)\u001B[0m";
|
def green($x): "\u001B[1;32m\($x)\u001B[0m";
|
||||||
def blue($x): "\u001B[1;34m\($x)\u001B[0m";
|
def blue($x): "\u001B[1;34m\($x)\u001B[0m";
|
||||||
|
|
||||||
def parse_iso8601:
|
|
||||||
# Parse an ISO 8601 date with timezone information
|
|
||||||
capture("(?<no_tz>[^.]*)(?<frac_sec>\\.\\d+)?(?:(?:(?<tz_sgn>[-+])(?<tz_hr>\\d{2}):?(?<tz_min>\\d{2})?)|Z)$") |
|
|
||||||
(.no_tz + "Z" | fromdateiso8601)
|
|
||||||
+ ("0"+.frac_sec | tonumber)
|
|
||||||
- (.tz_sgn + "60" | tonumber)
|
|
||||||
* ((.tz_hr // "0" | tonumber) * 60 + (.tz_min // "0" | tonumber))
|
|
||||||
| todateiso8601 | strptime("%FT%TZ");
|
|
||||||
|
|
||||||
def time:
|
def time:
|
||||||
# Extracts "HH:MM" from a timestamp
|
# Extracts "HH:MM" from a timestamp
|
||||||
parse_iso8601 | mktime | strftime("%R");
|
match("T([0-9]+:[0-9]+)"; null) | .captures[0].string;
|
||||||
|
|
||||||
def delta($stop; $start):
|
def delta($stop; $start):
|
||||||
# Computes the time elapsed between two dates
|
# Computes the time elapsed between two dates
|
||||||
|
Loading…
Reference in New Issue
Block a user