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

--localtime: Use local time instead of UTC (include timezone abbrevation in the name) #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

polletfa
Copy link

Yet another proposed solution for the date problem (#74), which also address the possible name collision because of DST.

The default behaviour is unchanged but a new option is added: -L or --localtime.
Ẃith this option, the local time is used and the timezone abbreviation is added to the name.
This avoid problems with DST and also avoid confusion when switching from UTC to local time.
The matching mechanism in do_snapshot to identify older snapshots was modified so as to match both formats (UTC without timezone indication and localtime with timezone) and also accept variable-length strings since the timezone abbreviation has variable length.

@polletfa polletfa mentioned this pull request May 16, 2019
@hbh7
Copy link

hbh7 commented Jan 28, 2020

Something of note is that if your default /bin/sh is dash (common on Debian, Ubuntu based systems, possibly others), then your line 211: if [ "${jj:0:${#trunc}}" = "$trunc" ] will fail and throw a Bad substitution error. Changing the shebang to /bin/bash solved this for me, although I think a more general solution would be something else.

Credit: https://stackoverflow.com/questions/20615217/bash-bad-substitution

@polletfa
Copy link
Author

Thanks for the advice. I’ll see how I can rewrite it without bashism.

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