3 ms·
Is there a standard for Durations, like we have for Time? (Like RFC3339)
by oatmeal_croc 5y ago
Is there a standard for Durations, like we have for Time? (Like RFC3339)
- rotifer 5y agoISO 8601 specifies durations [1]. For example, Java's Duration type [2] is based upon it. Depending on your language, and how much type safety you want, you could use something Haskell's units library [3]. I believe F# also has units [4], possibly built in to the language? (I've never used F#.) [1] https://en.wikipedia.org/wiki/ISO_8601#Durations https://en.wikipedia.org/wiki/ISO_8601#Durations [2] https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/Duration.html https://docs.oracle.com/en/java/javase/11/docs/api/java.base... [3] https://hackage.haskell.org/package/units https://hackage.haskell.org/package/units [4] https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/units-of-measure https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe...