News for hackers. Stuff that matters.
Re:Please put units in names by windpower on Sunday March 20, 2022 @10:59PM (#30749680)
Swift is pretty good at this. e.g.:

  Task.sleep(nanoseconds: 3e11)
Re:Please put units in names by gh123man on Sunday March 20, 2022 @11:08PM (#30749757)
In swift I quite like DispatchTimeInterval's approach [1] (see Enumeration Cases). In most of my projects I end up adding a simple extension to TimeInterval to get the same behavior. Which makes reasoning about time very simple eg:

  Date().advanced(by: .hours(2) + .seconds(10))
I'm honestly not sure why TimeInterval doesn't include this representation by default.

1. https://developer.apple.com/documentation/dispatch/dispatcht...