本文整理汇总了Python中mx.DateTime.gmtime方法的典型用法代码示例。如果您正苦于以下问题:Python DateTime.gmtime方法的具体用法?Python DateTime.gmtime怎么用?Python DateTime.gmtime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mx.DateTime
的用法示例。
在下文中一共展示了DateTime.gmtime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import gmtime [as 别名]
def __init__(self, name, value, expires=None,
path=None, domain=None, secure=None):
""" Create a Netscape cookie for name with the given value.
If expires is given, the cookie will be a temporary cookie
which expires after a certain amount of time. expires may
be given as integer (seconds relative to the current
time), DateTime instance (absolute date/time) or
RelativeDateTime instance (relative date/time to current
time).
path, domain, secure work according to the Netscape
specification.
"""
self.name = name
self.value = value
if expires is not None:
# Long living cookie
if isinstance(expires, DateTime.DateTimeType):
self.expires = expires.gmtime()
elif isinstance(expires, DateTime.RelativeDateTime):
self.expires = DateTime.gmtime() + expires
else:
self.expires = DateTime.gmtime() + \
expires * DateTime.oneSecond
if path:
self.path = path
if domain:
self.domain = domain
if secure:
self.secure = 1
示例2: write
# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import gmtime [as 别名]
def write(self):
r = self.cnn.query(
"""
INSERT INTO test (kase, name, start_time, elapsed_time, username, hostname, process_info_start, process_info_end)
VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')
""" % (self.kase
, self.values["name"]
, str(DateTime.gmtime(self.values["start_time"]))[0:19]
, self.values["elapsed_time"]
, self.username
, self.hostname
, self.Text2SQLText(self.values["process_info_start"])
, self.Text2SQLText(self.values["process_info_end"])))
return int(r)
示例3: __init__
# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import gmtime [as 别名]
def __init__(self, description, results):
"""construct with the description fetched from a database cursor and
with the result rows from a query"""
data = []
for result in results:
row = {}
for item, desc in map(None, result, description):
if desc[1] == 'DATE':
if item is not None:
item = DateTime.gmtime(float(item))
elif desc[1] == 'RAW':
item = str(item)
row[string.lower(desc[0])] = item
data.append(row)
self.data = tuple(data)