mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-23 00:07:38 +00:00
use ISO-8601 date and time format, fixes #375
This commit is contained in:
parent
3aa3148250
commit
2e64c29e01
4 changed files with 14 additions and 9 deletions
|
@ -431,7 +431,7 @@ def do_info(self, args):
|
|||
print('Fingerprint: %s' % hexlify(archive.id).decode('ascii'))
|
||||
print('Hostname:', archive.metadata[b'hostname'])
|
||||
print('Username:', archive.metadata[b'username'])
|
||||
print('Time: %s' % to_localtime(archive.ts).strftime('%c'))
|
||||
print('Time: %s' % format_time(to_localtime(archive.ts)))
|
||||
print('Command line:', remove_surrogates(' '.join(archive.metadata[b'cmdline'])))
|
||||
print('Number of files: %d' % stats.nfiles)
|
||||
print()
|
||||
|
|
|
@ -449,12 +449,9 @@ def dir_is_tagged(path, exclude_caches, exclude_if_present):
|
|||
|
||||
|
||||
def format_time(t):
|
||||
"""Format datetime suitable for fixed length list output
|
||||
"""use ISO-8601 date and time format
|
||||
"""
|
||||
if abs((datetime.now() - t).days) < 365:
|
||||
return t.strftime('%b %d %H:%M')
|
||||
else:
|
||||
return t.strftime('%b %d %Y')
|
||||
return t.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
|
||||
def format_timedelta(td):
|
||||
|
@ -510,7 +507,7 @@ def sizeof_fmt_decimal(num, suffix='B', sep='', precision=2):
|
|||
|
||||
|
||||
def format_archive(archive):
|
||||
return '%-36s %s' % (archive.name, to_localtime(archive.ts).strftime('%c'))
|
||||
return '%-36s %s' % (archive.name, format_time(to_localtime(archive.ts)))
|
||||
|
||||
|
||||
def memoize(function):
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
today_fmt = '%Y-%m-%d'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
|
@ -131,7 +131,7 @@
|
|||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
html_last_updated_fmt = '%Y-%m-%d'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
|
|
|
@ -140,6 +140,14 @@ indicated using the `IEC binary prefixes
|
|||
using powers of two (so ``KiB`` means 1024 bytes).
|
||||
|
||||
|
||||
Date and Time
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
We format date and time conforming to ISO-8601, that is: YYYY-MM-DD and HH:MM:SS
|
||||
|
||||
For more information, see: https://xkcd.com/1179/
|
||||
|
||||
|
||||
.. include:: usage/init.rst.inc
|
||||
|
||||
Examples
|
||||
|
|
Loading…
Reference in a new issue