Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-pipeline
csst_common
Commits
5ad5dfe7
Commit
5ad5dfe7
authored
Dec 20, 2023
by
BO ZHANG
🏀
Browse files
use astropy.time
parent
3570fb46
Pipeline
#2584
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_common/time.py
View file @
5ad5dfe7
...
...
@@ -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
date
time
from
astropy
import
time
def
now
():
"""Return ISOT
8601
format datetime
, for time stamps in data products
."""
return
date
time
.
datet
ime
.
now
().
strftime
(
"%Y-%m-%dT%H:%M:%S.%f"
)
"""Return ISOT format datetime
using `astropy`
."""
return
time
.
T
ime
.
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")
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment