Commit 2ce2cdbd authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

add time module

parent 8b383347
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ from csst_dfs_api.sls.level2spectra import Level2SpectraApi as SlsLevel2DataApi
from .logger import get_logger
from .params import CSST_PARAMS as CP
from .params import DFS_CONF
from .time import now, now_dfs


class CsstMsDataManager:
@@ -289,8 +290,11 @@ class CsstMsDataManager:

    @staticmethod
    def now():
        """ Return ISOT8601 format datetime. """
        return datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%f')
        return now()

    @staticmethod
    def now_dfs():
        return now_dfs()

    # DFS APIs
    @property

csst_common/time.py

0 → 100644
+11 −0
Original line number Diff line number Diff line
import datetime


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')