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


Python Utility.epoch_to_iso8601方法代码示例

本文整理汇总了Python中utility.Utility.epoch_to_iso8601方法的典型用法代码示例。如果您正苦于以下问题:Python Utility.epoch_to_iso8601方法的具体用法?Python Utility.epoch_to_iso8601怎么用?Python Utility.epoch_to_iso8601使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utility.Utility的用法示例。


在下文中一共展示了Utility.epoch_to_iso8601方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: set_newest_record_time

# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import epoch_to_iso8601 [as 别名]
    def set_newest_record_time(self, db_type, timestamp):
        """Set the newest record time.

        Args:
            timestamp (str): Epoch time to be written to file  If not string,
                will be coerced to string.

        """
        record_file = "%s.%s" % (self.newest_record_file, db_type)
        with open(record_file, 'w') as u_file:
            print("FeedManager: Setting newest DB record to %s in %s" % (Utility.epoch_to_iso8601(timestamp), record_file))  # NOQA
            u_file.write(str(timestamp).replace('.0', ''))
        return
开发者ID:sitch-io,项目名称:sensor,代码行数:15,代码来源:feed_manager.py

示例2: get_newest_record_time

# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import epoch_to_iso8601 [as 别名]
 def get_newest_record_time(self, db_type):
     """Get the newest record time from file in feed dir."""
     result = 0
     rx = r'^\d{10}$'
     target_file = "%s.%s" % (self.newest_record_file, db_type)
     if not os.path.isfile(target_file):
         print("FeedManager: No record of last update found at %s..." % target_file)  # NOQA
         return result
     with open(target_file, 'r') as u_file:
         first_line = u_file.readline().replace('\n', '').replace('.0', '')
         if re.match(rx, first_line):
             result = first_line
             print("FeedManager: Newest DB record timestamp is %s" % Utility.epoch_to_iso8601(result))  # NOQA
         else:
             print("FeedManager: Unable to parse newest DB record timestamp: %s from %s" % (first_line, target_file))  # NOQA
     return result
开发者ID:sitch-io,项目名称:sensor,代码行数:18,代码来源:feed_manager.py


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