Skip to content

Conversation

phip1611
Copy link
Member

@phip1611 phip1611 commented Jul 13, 2021

Hi! The current fmt::Debug impl for the Time struct didn't included leading zeroes, which is a bit odd. I optimized the implementation. fmt::Display was completely missing,

Current debug-format looks like: Time: 2021-07-13 21:14:46.000000000, Timezone=unspecified, Daylight=(empty)
and current display-format looks like this: Time: 2021-07-14 07:00:37.000 (local) (or Time: 2021-07-14 07:00:37.000 UTC+2)

I tested it inside my QEMU setup.

Furthermore I changed the debug formatting for the time zone and the daylight fields of a Time struct a bit. The current approach was strange, because for example, users got a weird number for the Timezone without explanation, that this number is the time zone.

What do you think?

@phip1611 phip1611 changed the title better debug fmt for Time struct better fmt::Debug for Time struct + fmt::Display Jul 14, 2021
@GabrielMajeri
Copy link
Collaborator

Thanks for improving this structure!

@GabrielMajeri GabrielMajeri changed the title better fmt::Debug for Time struct + fmt::Display Better fmt::Debug for Time struct + fmt::Display Jul 31, 2021
@GabrielMajeri GabrielMajeri merged commit 2d2e5a2 into rust-osdev:master Jul 31, 2021
@phip1611 phip1611 deleted the time-better-debug-fmt branch January 23, 2022 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants