예제 #1
0
def get_time_range(time_str, interval):
    """
    Returns pair of RichDateTime.
    """
    d = timedelta(minutes=interval)
    if time_str:
        # parse string as localtime
        t = RichDateTime.strptime(time_str, '%Y%m%d%H%M')
    else:
        # get current time in localtime
        t = RichDateTime.from_datetime((RichDateTime.now() % d) - d)
    return t, RichDateTime.from_datetime(t + d)
예제 #2
0
def get_time_range(time_str, interval):
    """
    Returns pair of RichDateTime.
    """
    d = timedelta(minutes=interval)
    if time_str:
        # parse string as localtime
        t = RichDateTime.strptime(time_str, '%Y%m%d%H%M')
    else:
        # get current time in localtime
        t = RichDateTime.from_datetime((RichDateTime.now() % d) - d)
    return t, RichDateTime.from_datetime(t + d)
예제 #3
0
 def f(datapoint):
     # read timestamp as local time
     t = RichDateTime.from_datetime(datapoint['Timestamp'], tzlocal())
     return metric, statistics, datapoint[statistics], t
예제 #4
0
 def f(datapoint):
     # read timestamp as local time
     t = RichDateTime.from_datetime(datapoint['Timestamp'], tzlocal())
     return metric, statistics, datapoint[statistics], t