Support multiple time format in --time option


Currently, there is only one predefined TimeFormat for parsing the option --time in restic, which is not flexible enough in my opinion.
It cannot store nanoseconds, and timezone (currently UTC).

How about trying to parse the time string with a subset of Golang predefined time-format as well as the current one and accepting a reference file?


Can you tell us why you are worried about specifying nanoseconds for your snapshots?
I wouldn’t find it very useful to have nanoseconds as I don’t make snapshots multiple times a second.

1 Like

You’re right. I don’t find it useful either.
The reason that I want this is just that the repo is able to store nanoseconds, so I want it to store that. :slight_smile:
It’s just a nice to have feature to support other time formats and enhance flexibility and usability.

Supporting a reference file is also an issue of flexibility and usability.
Although we can acquire the required format by date --rfc-3339=seconds -r <filename> to get mtime, and pipe it to cut -d+ -f1 for stripping the timezone, it’s a little bit complicated.

What’s your use case, big picture? Usually, --time is only needed when for example historical data is to be archived, which should have the right timestamp. What are you using it for?

I’m worrying about feature creep: does restic really need this? Or is it just “nice to have”? At the moment, I’m not convinced restic needs this. :slight_smile:

1 Like

The idea is to preserve as more information as possible, no matter it’s useful or not. As the nanoseconds are rarely used, supporting that is merely a nice-to-have.

Then, what about supporting a reference file/directory?
It’ll be useful when the historical data is based on directories/files, and ease the migration process.

Yeah this doesn’t sound like something restic needs to be frank. I just don’t see why anybody would like to see the nanoseconds where it would not benefit nothing restic actually does which is being a backup utility.
I think there are more interesting and pressing features on the horizon that need attention.

1 Like