本文整理汇总了Python中mx.DateTime.gmtoffset方法的典型用法代码示例。如果您正苦于以下问题:Python DateTime.gmtoffset方法的具体用法?Python DateTime.gmtoffset怎么用?Python DateTime.gmtoffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mx.DateTime
的用法示例。
在下文中一共展示了DateTime.gmtoffset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: jbofh_pquota_history
# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import gmtoffset [as 别名]
def jbofh_pquota_history(self, operator, person_id, when=None):
ret = []
if when is None:
when = cereconf.PQ_MAX_LIGHT_HISTORY_WHEN
for r in self._pquota_history(
operator, self.bu.find_person(person_id), when):
tstamp = r['tstamp']
trace = r.get('trace', '') or ""
# Only consider the last hop of the trace.
if trace.count(","):
trace = trace.split(",")[-1]
# Ignore trace values including space, they're on the
# obsoleted human-readable format.
if trace.count(":") and not trace.count(" "):
from mx.DateTime import DateTime, DateTimeDeltaFromSeconds
# TODO: what is this code supposed to do? last_event
# is not defiend. Fix!
time_t = int(last_event.split(":")[-1])
tstamp = DateTime(1970) + DateTimeDeltaFromSeconds(time_t)
tstamp += tstamp.gmtoffset()
tmp = {
'job_id': r['job_id'],
'transaction_type': r['transaction_type'],
'tstamp': tstamp,
'pageunits_free': r['pageunits_free'],
'pageunits_accum': r['pageunits_accum'],
'pageunits_paid': r['pageunits_paid'],
'kroner': float(r['kroner'])}
if not r['update_by']:
r['update_by'] = r['update_program']
tmp['update_by'] = r['update_by'][:10]
if r['transaction_type'] == six.text_type(self.const.pqtt_printout):
tmp['data'] = (
"%s:%s" % (r['printer_queue'][:10], r['job_name']))[:20]
elif r['transaction_type'] == six.text_type(self.const.pqtt_quota_fill_pay):
tmp['data'] = "%s:%s kr" % (r['description'][:10], r['kroner'])
elif r['transaction_type'] == six.text_type(self.const.pqtt_quota_fill_free):
tmp['data'] = r['description']
elif r['transaction_type'] == six.text_type(self.const.pqtt_undo):
tmp['data'] = ("undo %s: %s" % (r['target_job_id'],
r['description']))[:20]
elif r['transaction_type'] == six.text_type(self.const.pqtt_balance):
tmp['data'] = "balance"
ret.append(tmp)
# Transaction order may be different from the job completion order
ret.sort(lambda a, b: cmp(a['tstamp'], b['tstamp']))
return ret