uutils / parse_datetime

Parses a relative time string and returns a `Duration`
MIT License
14 stars 17 forks source link

Negative numbers for @ are not being recognized #40

Closed philolo1 closed 9 months ago

philolo1 commented 10 months ago

While "@0" and "@positive" integer work, "@-1" does not work.

On GNU date it returns the time in seconds before JAN 01 1970.

For example:

"date -d '@-1'"     
Thu Jan  1 08:59:59 JST 1970
"date -d '@-1000000'"           
Sat Dec 20 19:13:20 JST 1969
philolo1 commented 10 months ago

I would suggest we also use nom for this and extract part of the code that currently handles "@" and create a new file parse_timestamp to make the code more readable. @sylvestre @tertsdiepraam