diff --git a/csst_common/time.py b/csst_common/time.py index 4585138d6fa0fa418f14ec3a2be8bdc43ef36457..a6bd1f0fdc867d3a8f5326dfc8de86947c126cb0 100644 --- a/csst_common/time.py +++ b/csst_common/time.py @@ -7,15 +7,21 @@ Created: 2023-03-09 Modified-History: 2023-03-09, Bo Zhang, created 2023-03-09, Bo Zhang, add two time formats + 2023-12-20, Bo Zhang, use astropy.time """ -import datetime +from astropy import time def now(): - """Return ISOT8601 format datetime, for time stamps in data products.""" - return datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f") + """Return ISOT format datetime using `astropy`.""" + return time.Time.now().isot -def now_dfs(): - """Return ISOT8601 format datetime, for DFS usage only.""" - return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") +# def now(): +# """Return ISOT8601 format datetime, for time stamps in data products.""" +# return datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f") + + +# def now_dfs(): +# """Return ISOT8601 format datetime, for DFS usage only.""" +# return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")