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

Timezone Selection #16

Merged
merged 7 commits into from
Sep 18, 2023
Merged

Timezone Selection #16

merged 7 commits into from
Sep 18, 2023

Conversation

simonwiles
Copy link
Contributor

Okay, here's a (tested) implementation of a --timezone argument that accepts IANA timezone names in the America/Los_Angeles style. Here it is running on a server in Germany:

$ while true; do date; sleep 2; done | spacer --timezone America/Los_Angeles
Wed 13 Sep 21:02:40 CEST 2023
2023-09-13 12:02:41 PDT 1.0s ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Wed 13 Sep 21:02:42 CEST 2023
2023-09-13 12:02:43 PDT 2.0s ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Wed 13 Sep 21:02:44 CEST 2023
2023-09-13 12:02:45 PDT 2.0s ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Wed 13 Sep 21:02:46 CEST 2023
2023-09-13 12:02:47 PDT 2.0s ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
...

Submitted for your consideration.

Closes #12.

Only if `--timezone` is passed (otherwise format is unchanged).

Note: `DateTime<Tz>.format("%Z")` outputs, e.g., "PDT"; `DateTime<Local>.format("%Z")` outputs, e.g., "-07:00".
Tests need updating to account for new command-line argument (new functionality is not tested).
Cargo.toml Outdated Show resolved Hide resolved
@samwho
Copy link
Owner

samwho commented Sep 17, 2023

Just the one small change requested. Thank you for your contributions to spacer! 🙏

Elected to add test for a specific timezone, rather than merely for "a timezone" -- seems like a better test.
@simonwiles
Copy link
Contributor Author

simonwiles commented Sep 18, 2023

Thank you! This small change makes this super-useful little tool even more chef's kiss for me 🙂

@samwho samwho merged commit 7870c1f into samwho:main Sep 18, 2023
13 checks passed
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.

Timezone for timestamps
2 participants