Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new date command #112

Merged
merged 8 commits into from Nov 10, 2020
Merged

Add new date command #112

merged 8 commits into from Nov 10, 2020

Conversation

vinc
Copy link
Owner

@vinc vinc commented Nov 8, 2020

Back when MOROS was using cargo-xbuild we couldn't compile the time crate (time-rs/time#268) but now that it doesn't use it anymore (#83) we can compile it.

So we can now have a new date command that accepts formatting (https://time-rs.github.io/time/time/index.html#formatting).

> date
2020-11-08T23:47:02

> date "%A, %B %d, %Y"
Sunday, November 08, 2020

@vinc
Copy link
Owner Author

vinc commented Nov 8, 2020

With nanoseconds precision:

> date "%F %H:%M:%S.%N"
2020-11-09 00:20:17.307953119

@vinc
Copy link
Owner Author

vinc commented Nov 9, 2020

Added an env command to set a TZ env var used by the date command to display the date with a UTC offset.

In the future we'll want to import a time zone database to find the UTC offset for a given date and time zone, we could also add a geosearch to the database to use latitude and longitude instead of strings like Europe/Paris and be compatible with the geotime command that use longitude.

At the moment MOROS will continue to be generally unaware of time zones and assume the RTC is using locale time.

@vinc vinc merged commit ea705f5 into master Nov 10, 2020
@vinc vinc deleted the feature/new-date-command branch November 10, 2020 07:39
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.

None yet

1 participant