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

Added timezone support to time #2096

Closed
wants to merge 7 commits into from
Closed

Added timezone support to time #2096

wants to merge 7 commits into from

Conversation

rdelfin
Copy link

@rdelfin rdelfin commented May 25, 2020

This adds support in the time segments to take in optional timezone and suffix parameters. This will allow users to display multiple time zones on their powerline. This is especially useful on servers that are configured to have a standard timezone for ease of configuration (like UTC) but the user will be using the machine from a specific local timezone.

@rdelfin
Copy link
Author

rdelfin commented May 25, 2020

I'm not sure this is ready for merge. Part of my issue is that, when testing locally, adding the timezone arg in my theme config makes the segment go away. Interestingly enough though, running powerline-render tmux right does show the additional segment. Does anyone know why there would be this discrepancy? I can confirm that removing the "timezone" arg makes the segment immediately re-appear on my powerline.

@PH111P
Copy link
Member

PH111P commented May 26, 2020

Hi,
While I appreciate your work, I think there is a simpler solution using strptime (that doesn't require pytz):

    tz = datetime.strptime(timezone, '%z').tzinfo if timezone else None

I have such an implementation lying around; perhaps now is a good time to polish it.

(Edit: Note that in this solution, you need to specify timezones as the corresponding shift in time, i.e., +0100, -0500, etc.)

@PH111P
Copy link
Member

PH111P commented May 26, 2020

Also see #1337

@PH111P
Copy link
Member

PH111P commented May 26, 2020

I'm not sure this is ready for merge. Part of my issue is that, when testing locally, adding the timezone arg in my theme config makes the segment go away. Interestingly enough though, running powerline-render tmux right does show the additional segment. Does anyone know why there would be this discrepancy? I can confirm that removing the "timezone" arg makes the segment immediately re-appear on my powerline.

Regarding this discrepancy, try to restart the powerline-daemon. The old daemon still doesn't know about the new argument to the segment and thus cannot compute the segment.

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

2 participants