[General][Added] Support for time stamp in the date

- i.e. 2023-04-02T09:22-03:00
This commit is contained in:
Salvador E. Tropea 2023-04-02 09:54:30 -03:00
parent 8a00b90949
commit 1a1311dc6d
2 changed files with 4 additions and 2 deletions

View File

@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.6.2] - UNRELEASED ## [1.6.2] - UNRELEASED
### Added ### Added
- General:
- Support for time stamp in the date (i.e. 2023-04-02T09:22-03:00)
- Command line: - Command line:
- `--banner N` Option to display a banner - `--banner N` Option to display a banner
- `--log FILE` Option to log to a file, in addition to the stderr - `--log FILE` Option to log to a file, in addition to the stderr

View File

@ -13,7 +13,7 @@ except ImportError:
class pcbnew(object): class pcbnew(object):
IU_PER_MM = 1 IU_PER_MM = 1
IU_PER_MILS = 1 IU_PER_MILS = 1
from datetime import datetime, date from datetime import datetime
from sys import exit from sys import exit
from shutil import copy2 from shutil import copy2
from .misc import EXIT_BAD_ARGS, W_DATEFORMAT, W_UNKVAR, WRONG_INSTALL from .misc import EXIT_BAD_ARGS, W_DATEFORMAT, W_UNKVAR, WRONG_INSTALL
@ -247,7 +247,7 @@ class GS(object):
return datetime.fromtimestamp(os.path.getmtime(fname)).strftime(GS.global_date_time_format) return datetime.fromtimestamp(os.path.getmtime(fname)).strftime(GS.global_date_time_format)
elif GS.global_time_reformat: elif GS.global_time_reformat:
try: try:
dt = date.fromisoformat(d) dt = datetime.fromisoformat(d)
except ValueError as e: except ValueError as e:
logger.warning(W_DATEFORMAT+"Trying to reformat {} time, but not in ISO format ({})".format(what, d)) logger.warning(W_DATEFORMAT+"Trying to reformat {} time, but not in ISO format ({})".format(what, d))
logger.warning(W_DATEFORMAT+"Problem: {}".format(e)) logger.warning(W_DATEFORMAT+"Problem: {}".format(e))