当前位置: 首页>>代码示例>>Python>>正文


Python DateTime.gmtime方法代码示例

本文整理汇总了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
开发者ID:ourway,项目名称:Vixen,代码行数:35,代码来源:Cookie.py

示例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)
开发者ID:mmccarty,项目名称:nell,代码行数:18,代码来源:dbArchiver.py

示例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)
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:19,代码来源:__init__.py


注:本文中的mx.DateTime.gmtime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。