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


Python Library.timestamp方法代码示例

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


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

示例1: dateOverlapCheck

# 需要导入模块: import Library [as 别名]
# 或者: from Library import timestamp [as 别名]
 def dateOverlapCheck(self, startTime, stopTime): 
     
     startTimeSec = Library.timestamp(Library.timeConv(startTime))
     stopTimeSec = startTimeSec + float(stopTime)
     # print startTimeSec
     # print stopTimeSec
     
     dtNowSec = Library.timestamp(dt.now())
     # print "dt.now():",dt.now()
     # print "dtNow:",dtNowSec
     
     if startTimeSec <= dtNowSec or stopTimeSec <= dtNowSec:
         print "Error: Dates cannot be in the past"
         return "Error: Dates cannot be in the past"
         
 
     if startTimeSec >= stopTimeSec:
         print "Start Date cannot be the same or later than stop time"
         return 
         
      
     n = "1"
     try:
         conn = Library.dbconn()
         c = conn.cursor()
     
         c.execute('SELECT startTime, stopTime FROM emulationLifetime')
                 
         emulationLifetimeFetch = c.fetchall()
         
         if emulationLifetimeFetch:
             for row in emulationLifetimeFetch:
                 # print row
                 startTimeDBsec = Library.timestamp(Library.timeConv(row[0]))
                 stopTimeDBsec = startTimeDBsec + float(row[1])
                 
                 if startTimeSec >= startTimeDBsec and startTimeSec <= stopTimeDBsec:
                     # print "Emulation already exist for this date change the date(1)"
                     
                     n = "Emulation already exist for this date change the date(1)"
                 
                     
                     
                 if stopTimeSec >= startTimeDBsec and stopTimeSec <= stopTimeDBsec:
                     # print "Emulation already exist for this date change the date(2)"
                     n = "Emulation already exist for this date change the date(2)"
                     
                     
                 
                 if startTimeSec <= startTimeDBsec and stopTimeSec >= stopTimeDBsec:
                     # print "Emulation already exist for this date change the date(3)"
                     
                     n = "Emulation already exist for this date change the date(3)"
                     
                     
                 
         else:
             pass    
         conn.commit()
         c.close()
     except Exception, e:
         print "dateOverlapCheck() SQL Error %s:" % e.args[0]
         print e
         return str(e)
开发者ID:cragusa,项目名称:cocoma,代码行数:66,代码来源:Emulation.py


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