All Samples(5843) | Call(5208) | Derive(0) | Import(635)
gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,
tm_sec, tm_wday, tm_yday, tm_isdst)
Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a.
GMT). When 'seconds' is not passed in, convert the current time instead.src/p/y/pyjamas-0.7/examples/libtest/TimeModuleTest.py Pyjamas(Download)
def testBasics(self):
t = time.time()
self.assertTrue(t > 1246924800, "time.time() result invalid")
ttuple1 = time.gmtime(t)
t1 = time.mktime(ttuple1)
ttuple2 = time.localtime(t + time.timezone)
t2 = time.mktime(ttuple2)
self.assertTrue(t1 == t2, "t1 and t2 differ")
self.assertEqual(ttuple1[0], ttuple2[0])
self.assertEqual(ttuple1[1], ttuple2[1])
self.assertEqual(ttuple1[2], ttuple2[2])
t = 1246446123
ttuple = time.gmtime(t)
def testStrftime(self):
t = 1246446000
ttuple = time.gmtime(t)
s = time.strftime("-%%-%d-%H-%I-%j-%m-%M-%p-%S-%w-%W-%y-%Y-", ttuple)
self.assertEqual(s, "-%-01-11-11-182-07-00-AM-00-3-26-09-2009-")
s = time.strftime("%c")
s = time.strftime("%x")
src/p/o/polinax-HEAD/libs/external_libs/gdata.py-1.0.13/samples/calendar/calendarExample.py polinax(Download)
else:
if start_time is None:
# Use current time for the start_time and have the event last 1 hour
start_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z', time.gmtime())
end_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z',
time.gmtime(time.time() + 3600))
event.when.append(gdata.calendar.When(start_time=start_time,
src/b/a/badger-lib-HEAD/packages/gdata/samples/calendar/calendarExample.py badger-lib(Download)
else:
if start_time is None:
# Use current time for the start_time and have the event last 1 hour
start_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z', time.gmtime())
end_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z',
time.gmtime(time.time() + 3600))
event.when.append(gdata.calendar.When(start_time=start_time,
src/g/d/gdata-python-client-HEAD/samples/calendar/calendarExample.py gdata-python-client(Download)
else:
if start_time is None:
# Use current time for the start_time and have the event last 1 hour
start_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z', time.gmtime())
end_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z',
time.gmtime(time.time() + 3600))
event.when.append(gdata.calendar.When(start_time=start_time,
src/g/o/google-data-api-HEAD/samples/calendar/calendarExample.py google-data-api(Download)
else:
if start_time is None:
# Use current time for the start_time and have the event last 1 hour
start_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z', time.gmtime())
end_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z',
time.gmtime(time.time() + 3600))
event.when.append(gdata.calendar.When(start_time=start_time,
src/g/d/gdata-python-HEAD/samples/calendar/calendarExample.py gdata-python(Download)
else:
if start_time is None:
# Use current time for the start_time and have the event last 1 hour
start_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z', time.gmtime())
end_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z',
time.gmtime(time.time() + 3600))
event.when.append(gdata.calendar.When(start_time=start_time,
src/p/o/pony-build-HEAD/examples/push-cgi-notifier/feedparser.py pony-build(Download)
ordinal = 0
year = params.get('year', '--')
if not year or year == '--':
year = time.gmtime()[0]
elif len(year) == 2:
# ISO 8601 assumes current century, i.e. 93 -> 2093, NOT 1993
year = 100 * int(time.gmtime()[0] / 100) + int(year)
if ordinal:
month = 1
else:
month = time.gmtime()[1]
month = int(month)
day = params.get('day', 0)
if not day:
params.get('year', 0) or params.get('month', 0):
day = 1
else:
day = time.gmtime()[2]
else:
day = int(day)
# special case of the century - is the first year of the 21st century
def __extract_date(m):
year = int(m.group('year'))
if year < 100:
year = 100 * int(time.gmtime()[0] / 100) + int(year)
if year < 1000:
return 0, 0, 0
julian = m.group('julian')
jday = None
while jday != julian:
t = time.mktime((year, month, day, 0, 0, 0, 0, 0, 0))
jday = time.gmtime(t)[-2]
diff = abs(jday - julian)
if jday > julian:
if diff < day:
if (m is None) or (m.group() != dateString): return
gmt = __extract_date(m) + __extract_time(m) + (0, 0, 0)
if gmt[0] == 0: return
return time.gmtime(time.mktime(gmt) + __extract_tzd(m) - time.timezone)
registerDateHandler(_parse_date_w3dtf)
def _parse_date_rfc822(dateString):
dateString += ' 00:00:00 GMT'
tm = rfc822.parsedate_tz(dateString)
if tm:
return time.gmtime(rfc822.mktime_tz(tm))
# rfc822.py defines several time zones, but we define some extra ones.
# 'ET' is equivalent to 'EST', etc.
_additional_timezones = {'AT': -400, 'ET': -500, 'CT': -600, 'MT': -700, 'PT': -800}
src/p/y/PySAML-HEAD/examples/simpleAssertion/simpleAssertion.py PySAML(Download)
authStatement = SAML.AuthenticationStatement(subject,"urn:oasis:names:tc:SAML:1.0:am:password",None)
# Create a conditions timeframe of 5 minutes (period in which assertion is valid)
notBefore = time.strftime("%Y-%m-%dT%H:%M:%SZ",time.gmtime())
notOnOrAfter = time.strftime("%Y-%m-%dT%H:%M:%SZ",time.gmtime(time.time() + 5))
conditions = SAML.Conditions(notBefore, notOnOrAfter)
src/p/y/PySAML-HEAD/examples/signedSimpleAssertion/signedSimpleAssertion.py PySAML(Download)
authStatement = SAML.AuthenticationStatement(subject,"urn:oasis:names:tc:SAML:1.0:am:password",None)
# Create a conditions timeframe of 5 minutes (period in which assertion is valid)
notBefore = time.strftime("%Y-%m-%dT%H:%M:%SZ",time.gmtime())
notOnOrAfter = time.strftime("%Y-%m-%dT%H:%M:%SZ",time.gmtime(time.time() + 5))
conditions = SAML.Conditions(notBefore, notOnOrAfter)
src/p/y/PySAML-HEAD/examples/postAssertion/postAssertion.py PySAML(Download)
authStatement = SAML.AuthenticationStatement(subject,"urn:oasis:names:tc:SAML:1.0:am:password",None)
# Create a conditions timeframe of 5 minutes (period in which assertion is valid)
notBefore = time.strftime("%Y-%m-%dT%H:%M:%SZ",time.gmtime())
notOnOrAfter = time.strftime("%Y-%m-%dT%H:%M:%SZ",time.gmtime(time.time() + 5))
conditions = SAML.Conditions(notBefore, notOnOrAfter)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next