From 093b15085b166bc77f7c5c40b965a4c097d73f96 Mon Sep 17 00:00:00 2001 From: Wirawan Purwanto Date: Wed, 23 Oct 2013 13:07:38 -0400 Subject: [PATCH] * utime_to_iso(): Let the local current time be the default input data. --- datetime.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/datetime.py b/datetime.py index b809359..fe7d4c5 100644 --- a/datetime.py +++ b/datetime.py @@ -37,14 +37,16 @@ def shift_time(t, dt, localtime=True): else: return time.gmtime(t1) -def utime_to_iso(t, local=True): +def utime_to_iso(t=None, local=True): """Converts UNIX time (seconds since Epoch) to ISO-formatted time string. In order to ease time computation/conversion, we will use numeric TZ shift (+/-HH:MM) instead of letter TZ code (EDT, EST, GMT, etc). """ - from time import localtime, gmtime, strftime, timezone + from time import time, localtime, gmtime, strftime, timezone + if t == None: + t = time() if local: tt = localtime(t) dtz = -timezone + tt.tm_isdst * 3600