Esempio n. 1
0
 def getTimeAgo(self, timestamp):
     now, then = int(time.time()), int(timestamp / 1000.0)
     time_ago = timesince(then,
                          now,
                          afterword='ago',
                          minute_granularity=True,
                          max_no_sections=2)
     if not time_ago:
         time_ago = 'seconds ago'
     return time_ago
Esempio n. 2
0
def getTimeAgo(timestamp):
    now, then = int(time.time()), int(timestamp / 1000.0)
    time_ago = timesince(
        then,
        now,
        afterword='ago',
        minute_granularity=True,
        max_no_sections=2)
    if not time_ago:
        time_ago = 'seconds ago'
    return time_ago
Esempio n. 3
0
def getTimeAgo(timestamp):
    # keeping this here amongst the view code because the use of the
    # timesince() function is specific to the view
    now, then = int(time.time()), int(timestamp / 1000.0)
    time_ago = timesince(then,
                         now,
                         afterword='ago',
                         minute_granularity=True,
                         max_no_sections=2)
    if not time_ago:
        time_ago = 'seconds ago'
    return time_ago
Esempio n. 4
0
def getTimeAgo(timestamp):
    # keeping this here amongst the view code because the use of the
    # timesince() function is specific to the view
    now, then = int(time.time()), int(timestamp / 1000.0)
    time_ago = timesince(
        then,
        now,
        afterword='ago',
        minute_granularity=True,
        max_no_sections=2
    )
    if not time_ago:
        time_ago = 'seconds ago'
    return time_ago