Skip to content

Commit

Permalink
added timezone to utils.get_current_date_time to correctly time stamp…
Browse files Browse the repository at this point in the history
… various experiments!
  • Loading branch information
gfursin committed Apr 27, 2024
1 parent 95f0605 commit e7d7f34
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cm/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## V2.2.0.1
- added timezone to utils.get_current_date_time to correctly time stamp various experiments!

## V2.2.0
- fixed detection of a CM artifact using 'cm info .' when inside virtual env entries.
- added "cmind.utils.debug_here" function to attach remote Python debugger
Expand Down
2 changes: 1 addition & 1 deletion cm/cmind/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.2.0"
__version__ = "2.2.0.1"

from cmind.core import access
from cmind.core import error
Expand Down
12 changes: 10 additions & 2 deletions cm/cmind/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,8 @@ def get_current_date_time(i):
Get current date and time.
Args:
(CM input dict): empty dict
(CM input dict):
- (timezone) (str): timezone in pytz format: "Europe/Paris"
Returns:
(CM return dict):
Expand All @@ -1239,7 +1240,14 @@ def get_current_date_time(i):

a = {}

now1 = datetime.datetime.now()
tz = None

tz_str = i.get('timezone', '').strip()
if tz_str != '':
import pytz
tz = pytz.timezone(tz_str)

now1 = datetime.datetime.now(tz)
now = now1.timetuple()

a['date_year'] = now[0]
Expand Down

0 comments on commit e7d7f34

Please sign in to comment.