bug#71986: RFC: date @ to support ms.

2024-07-09 Thread Paul Eggert
On 7/9/24 03:19, Richard Neill wrote: IP_JSON=$(curl https://whatsmyip.dev/api/ip) TS=$(echo $IP_JSON | jq '.ts' -r) TS=$(echo "$TS/1000" | bc) DATE=$(date --date @$TS) This is better, as it saves on subprocesses: IP_JSON=$(curl https://whatsmyip.dev/api/ip) TS=$(jq -nr "$IP_JSON|.ts") DATE=$

bug#71986: RFC: date @ to support ms.

2024-07-08 Thread Richard Neill
Thanks, Paul, On 09/07/2024 01:52, Paul Eggert wrote: On 7/8/24 21:18, Richard Neill wrote: Also, this is an increasingly common format to see as an input In shell apps? News to me. I thought it was more of a Java and/or JavaScript thing. Those languages love ms. POSIX, though, prefers ns.

bug#71986: RFC: date @ to support ms.

2024-07-08 Thread Paul Eggert
On 7/8/24 21:18, Richard Neill wrote: Also, this is an increasingly common format to see as an input In shell apps? News to me. I thought it was more of a Java and/or JavaScript thing. Those languages love ms. POSIX, though, prefers ns. For occasional use one can just use the shell, with no

bug#71986: RFC: date @ to support ms.

2024-07-08 Thread Richard Neill
On 08/07/2024 17:33, Andreas Schwab wrote: date --date='@1720378861.258' --rfc-3339=ns Thanks. The problem is that the input string (from elsewhere) is "1720378861258" i.e. it's "integer ms", not "seconds with a decimal". Also, this is an increasingly common format to see as an input Slightly

bug#71986: RFC: date @ to support ms.

2024-07-08 Thread Andreas Schwab
On Jul 07 2024, Richard Neill wrote: > I've noticed a lot of systems now return the timestamp in milliseconds > since the epoch, rather than seconds. This means that e.g. > > date --date='@1720378861258' > > will do something rather unexpected! > > May I suggest that it would be nice if date had

bug#71986: RFC: date @ to support ms.

2024-07-08 Thread Richard Neill
Hello Pádraig, On 08/07/2024 12:33, Pádraig Brady wrote: On 07/07/2024 20:46, Richard Neill wrote: Hello, I've noticed a lot of systems now return the timestamp in milliseconds since the epoch, rather than seconds. This means that e.g.     date --date='@1720378861258' will do something rathe

bug#71986: RFC: date @ to support ms.

2024-07-08 Thread Pádraig Brady
On 07/07/2024 20:46, Richard Neill wrote: Hello, I've noticed a lot of systems now return the timestamp in milliseconds since the epoch, rather than seconds. This means that e.g. date --date='@1720378861258' will do something rather unexpected! May I suggest that it would be nice if date

bug#71986: RFC: date @ to support ms.

2024-07-07 Thread Richard Neill
Hello, I've noticed a lot of systems now return the timestamp in milliseconds since the epoch, rather than seconds. This means that e.g. date --date='@1720378861258' will do something rather unexpected! May I suggest that it would be nice if date had an input format that would let me spec