Zulip Chat Archive

Stream: lean4

Topic: Concern with `instance OfNat Timestamp` (and `Duration`)


Chris Wong (Jan 27 2025 at 11:36):

Hi all,

I've been looking at the new time library and it looks really good!

I have a minor concern about docs#Std.Time.instOfNatTimestamp and docs#Std.Time.instOfNatDuration. Those instances assume seconds. However, JavaScript uses milliseconds. If a developer blindly copies a value from their JavaScript code to Lean, they'll end up with a duration that's off by a factor of 1000.

Have we considered removing these two instances? We can use instead Timestamp.ofSecondsSinceUnixEpoch which is safer.

Eric Wieser (Jan 27 2025 at 11:36):

Or even have custom 10s / 10ms notation

Markus Himmel (Jan 27 2025 at 12:58):

Yes, let's track this at lean4#6793.


Last updated: May 02 2025 at 03:31 UTC