Time crate without dependencies

I am looking for a minimal time crate with no dependencies.

  • no system time detection
  • no parsing and formating
    I just want to be able to get the Duration between two DateTimes

Is there a crate that can do this?

What are "DateTimes" in that matter? Do you require time-zone support too?

1 Like

What information do you have to construct a DateTime with, if not by parsing?

1 Like

I think you can have year, month, day, hour, minute, second in UTC or any other time-zone that doesn't include DST switching, for example. Maybe that is what the OP is seeking. Hence my question on the time-zones.

1 Like

a type with year,month,day,hour,minute,second

with time-zone support

I think time-zone support always requires to draw in dependencies. That's because time zone data changes, and daylight-saving-time has an impact on the duration (in SI-seconds) between two "DateTimes". For example, from 8 a.m. to 8 a.m. on the next day, it could be 24 hours, 23 hours, or 25 hours (edit: disregarding leap seconds, if you truly account for "SI-seconds").

3 Likes

Is it even possible to find out a "time" without accessing the system clock?

Asking a server, asking the user, reading it from a database, etc.

1 Like

time has no dependencies when using no-default-features. Okay, technically it has time-core as a dependency, but that's also controlled by me and is merely an implementation detail.

It supports fixed UTC offsets, but not "proper" tzdb time zones at the moment.

6 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.