1 __all__=["writepid","removepid","daemonize"]
9 def diff_time(timestamp, abstime=True):
14 diff = now - timestamp
17 # return the number of seconds as a difference from current time.
19 if diff < 60: # sec in min.
21 t_str = "%s sec ago" % int(math.ceil(t))
22 elif diff < 60*60: # sec in hour
24 t_str = "%s min ago" % int(math.ceil(t))
25 elif diff < 60*60*24: # sec in day
27 t_str = "%s hrs ago" % int(math.ceil(t))
28 elif diff < 60*60*24*14: # sec in week
30 t_str = "%s days ago" % int(math.ceil(t))
31 elif diff <= 60*60*24*30: # approx sec in month
33 t_str = "%s days ago" % int(math.ceil(t))
34 elif diff > 60*60*24*30: # approx sec in month
35 t = diff / (60*60*24*30)
36 t_str = "%s mnths ago" % int(t)