hifitime icon indicating copy to clipboard operation
hifitime copied to clipboard

Optionally allow Chronos conversions

Open ChristopherRabotin opened this issue 5 years ago • 6 comments

This is helpful to support human-time which isn't UTC.

ChristopherRabotin avatar Aug 10 '20 23:08 ChristopherRabotin

This is getting useful when converting data from sources which do not use ISO.

ChristopherRabotin avatar Mar 12 '21 22:03 ChristopherRabotin

If you're considering optional chrono support, can you do the same for time?

mpfaff avatar Apr 16 '22 02:04 mpfaff

Yes, probably. I'm just not totally sure what chrono brings to the table at the moment. What features of chrono would you consider essential to a date and time management library?

On Fri, Apr 15, 2022, 20:01 Michael Pfaff @.***> wrote:

If you're considering optional chrono support, can you do the same for time?

— Reply to this email directly, view it on GitHub https://github.com/nyx-space/hifitime/issues/73#issuecomment-1100506042, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEZV2CB5A7KBG2ZAIN6EV3VFINOFANCNFSM4P2N2SVQ . You are receiving this because you were assigned.Message ID: @.***>

ChristopherRabotin avatar Apr 16 '22 17:04 ChristopherRabotin

My primary use for time (I prefer time over chrono) is formatting and parsing.

mpfaff avatar Apr 17 '22 02:04 mpfaff

OK. Is support for the RFC 3339 something you're looking for? I just went through the documentation of chrono and I can't tell what it does that hifitime can't apart from an initializer using system time. Maybe I'm missing something?

On Sat, Apr 16, 2022, 20:35 Michael Pfaff @.***> wrote:

My primary use for time (I prefer time over chrono) is formatting and parsing.

— Reply to this email directly, view it on GitHub https://github.com/nyx-space/hifitime/issues/73#issuecomment-1100790519, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEZV2ATRNMEMI6MCVP6RWTVFN2HTANCNFSM4P2N2SVQ . You are receiving this because you were assigned.Message ID: @.***>

ChristopherRabotin avatar Apr 17 '22 16:04 ChristopherRabotin

I don't currently have a use for hifitime where time/chrono wouldn't suffice. With that being said, if I were to use hifitime I would want to be able to parse and format RFC-3339 and get the current time from whatever system clock is available.

mpfaff avatar Apr 19 '22 01:04 mpfaff

Work plan:

  • [x] Include offsets in RFC3339 format (these can be easily converted to a Duration)
  • [ ] If the time system is not recognized (e.g. BST), and the timezones feature is enabled, then the FromStr implementation should call chrono-tz to parse the timezone by identifier.
  • [ ] If timezones feature is enabled, then the chrono datetime type should be castable into an Epoch.

ChristopherRabotin avatar Oct 04 '22 06:10 ChristopherRabotin

Chrono-tz does not support converting a named timezone into an offset, only the other way around. Therefore, this issue cannot be completed as such.

Instead, this feature had focused on correctly parsing RFC3339.

ChristopherRabotin avatar Oct 09 '22 17:10 ChristopherRabotin

Parsing RFC3339 (zulu and with offset) and getting the system time is now available via #149 .

ChristopherRabotin avatar Oct 09 '22 18:10 ChristopherRabotin