1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

add timestamp info

This commit is contained in:
Kelly Brazil
2022-07-20 23:02:16 -07:00
parent e27ed0743c
commit 2a11fefe45
2 changed files with 6 additions and 3 deletions

View File

@ -36,9 +36,11 @@ Schema:
"day_of_year": integer, "day_of_year": integer,
"week_of_year": integer, "week_of_year": integer,
"iso": string, "iso": string,
"timestamp": integer "timestamp": integer # [0]
} }
[0] timezone aware UNIX timestamp expressed in UTC
Examples: Examples:
$ echo "2022-07-20T14:52:45Z" | jc --iso-datetime -p $ echo "2022-07-20T14:52:45Z" | jc --iso-datetime -p

View File

@ -31,9 +31,11 @@ Schema:
"day_of_year": integer, "day_of_year": integer,
"week_of_year": integer, "week_of_year": integer,
"iso": string, "iso": string,
"timestamp": integer "timestamp": integer # [0]
} }
[0] timezone aware UNIX timestamp expressed in UTC
Examples: Examples:
$ echo "2022-07-20T14:52:45Z" | jc --iso-datetime -p $ echo "2022-07-20T14:52:45Z" | jc --iso-datetime -p
@ -302,7 +304,6 @@ def parse(data, raw=False, quiet=False):
'day_of_year': int(dt.strftime('%j')), 'day_of_year': int(dt.strftime('%j')),
'week_of_year': int(dt.strftime('%W')), 'week_of_year': int(dt.strftime('%W')),
'iso': dt.isoformat(), 'iso': dt.isoformat(),
# TODO: Check that timestamp is always based on UTC (aware)
'timestamp': int(dt.timestamp()) 'timestamp': int(dt.timestamp())
} }