當前位置: 首頁>>代碼示例>>Python>>正文


Python StatsDateLib.getCurrentTimeInIsoformat方法代碼示例

本文整理匯總了Python中pxStats.lib.StatsDateLib.StatsDateLib.getCurrentTimeInIsoformat方法的典型用法代碼示例。如果您正苦於以下問題:Python StatsDateLib.getCurrentTimeInIsoformat方法的具體用法?Python StatsDateLib.getCurrentTimeInIsoformat怎麽用?Python StatsDateLib.getCurrentTimeInIsoformat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pxStats.lib.StatsDateLib.StatsDateLib的用法示例。


在下文中一共展示了StatsDateLib.getCurrentTimeInIsoformat方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getTimeOfLastUpdateInLogs

# 需要導入模塊: from pxStats.lib.StatsDateLib import StatsDateLib [as 別名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getCurrentTimeInIsoformat [as 別名]
 def getTimeOfLastUpdateInLogs(self):
     """
         
         @summary : Returns the time of the last update in iso format.
    
         @return : None if no update as found, EPCH is returned in iso format,
                   as to make sure an update is made since no prior updates exist.
         
     """
     
     timeOfLastUpdate = StatsDateLib.getIsoTodaysMidnight( StatsDateLib.getCurrentTimeInIsoformat() ) 
     
     paths = StatsPaths()
     paths.setPaths()
     
     updatesDirectory = paths.STATSTEMPAUTUPDTLOGS + self.updateType + "/"
     
     if not os.path.isdir( updatesDirectory ):
         os.makedirs(updatesDirectory)       
     allEntries = os.listdir(updatesDirectory) 
     
     if allEntries !=[] :
         allEntries.sort()
         allEntries.reverse() 
         timeOfLastUpdate = os.path.basename( allEntries[0] ).replace( "_"," " )
         
         
     return timeOfLastUpdate
開發者ID:hawkeye438,項目名稱:metpx,代碼行數:30,代碼來源:AutomaticUpdatesManager.py

示例2: isFirstUpdateOfTheYear

# 需要導入模塊: from pxStats.lib.StatsDateLib import StatsDateLib [as 別名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getCurrentTimeInIsoformat [as 別名]
 def isFirstUpdateOfTheYear( self, timeOfUpdateInIsoFormat = "" ): 
     """
         @summary : Returns whether or not an update executed at 
                    timeOfUpdateInIsoFormat would be the first update 
                    of the year.
                    
         @timeOfUpdateInIsoFormat : Time at which the update would be executed.
         
         @return : True or False.
                     
     """
     
     isFirstUpdateOfTheYear = False
     
     lastUpdateISO = self.getTimeOfLastUpdateInLogs()
     
     if timeOfUpdateInIsoFormat == "" :
         timeOfUpdateInIsoFormat = StatsDateLib.getCurrentTimeInIsoformat()
         
     if timeOfUpdateInIsoFormat >  lastUpdateISO :
         
         yearNumberOfLastUpdate    = lastUpdateISO.split("-")[0] 
         yearNumberOfCurrentUpdate = timeOfUpdateInIsoFormat.split("-")[0]  
         
         if yearNumberOfLastUpdate != yearNumberOfCurrentUpdate:
             isFirstUpdateOfTheYear = True  
     
     
     return isFirstUpdateOfTheYear
開發者ID:hawkeye438,項目名稱:metpx,代碼行數:31,代碼來源:AutomaticUpdatesManager.py

示例3: isFirstUpdateOfTheWeek

# 需要導入模塊: from pxStats.lib.StatsDateLib import StatsDateLib [as 別名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getCurrentTimeInIsoformat [as 別名]
 def isFirstUpdateOfTheWeek( self, timeOfUpdateInIsoFormat = "" ): 
     """
         @summary : Returns whether or not an update executed at 
                    timeOfUpdateInIsoFormat would be the first update 
                    of the week.
                    
         @timeOfUpdateInIsoFormat : Time at which the update would be executed.
         
         @return : True or False.
                     
     """
     
     isFirstUpdateOfTheWeek = False
     
     lastUpdateISO = self.getTimeOfLastUpdateInLogs()
     
     if timeOfUpdateInIsoFormat == "" :
         timeOfUpdateInIsoFormat = StatsDateLib.getCurrentTimeInIsoformat()
         
     if timeOfUpdateInIsoFormat >  lastUpdateISO :
         lastUpdateDT    = datetime( int( lastUpdateISO.split("-")[0]),\
                                     int( lastUpdateISO.split("-")[1]),\
                                     int( lastUpdateISO.split("-")[1].split(" ")[0] )\
                                    )
    
         currentUpdateDT = datetime( int( timeOfUpdateInIsoFormat.split("-")[0]),\
                                     int( timeOfUpdateInIsoFormat.split("-")[1]),\
                                     int( timeOfUpdateInIsoFormat.split("-")[1].split(" ")[0] )\
                                    )
         
         weekNumberOfLastUpdate    = time.strftime( '%W', time.gmtime( StatsDateLib.getSecondsSinceEpoch( lastUpdateISO ) ) )
         weekNumberOfCurrentUpdate = time.strftime( '%W', time.gmtime( StatsDateLib.getSecondsSinceEpoch( timeOfUpdateInIsoFormat ) ) )
         
         timeBetweenBothDates = currentUpdateDT - lastUpdateDT
         daysBetween = timeBetweenBothDates.days
         
         if daysBetween < 7 and ( weekNumberOfLastUpdate == weekNumberOfCurrentUpdate ):  #<7 days prevents same week but from different years.
             isFirstUpdateOfTheWeek = False
         else:
             isFirstUpdateOfTheWeek = True    
             
     
     return isFirstUpdateOfTheWeek
開發者ID:hawkeye438,項目名稱:metpx,代碼行數:45,代碼來源:AutomaticUpdatesManager.py

示例4: getTimeSinceLastUpdate

# 需要導入模塊: from pxStats.lib.StatsDateLib import StatsDateLib [as 別名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getCurrentTimeInIsoformat [as 別名]
 def getTimeSinceLastUpdate(self, currentTimeInIsoFormat = "" ):
     """
         @summary : returns the number of seconds between the last update
                    and the currentTime  
     
         @param  currentTimeInIsoFormat: Current time specified in the ISO 
                                         format
                                         
         @return :  the number of seconds between the last update
                    and the currentTime                               
     """
     
     timeBetweenUpdates = 0 
     
     if currentTimeInIsoFormat == "":
         currentTimeInIsoFormat = StatsDateLib.getCurrentTimeInIsoformat()
    
     currentTimeInSSEFormat = StatsDateLib.getSecondsSinceEpoch( currentTimeInIsoFormat )   
     lastUpdateInSSEFormat  =  StatsDateLib.getSecondsSinceEpoch( self.getTimeOfLastUpdateInLogs() )
     
     if currentTimeInSSEFormat > lastUpdateInSSEFormat :
         timeBetweenUpdates = currentTimeInSSEFormat - lastUpdateInSSEFormat
     
     return timeBetweenUpdates
開發者ID:hawkeye438,項目名稱:metpx,代碼行數:26,代碼來源:AutomaticUpdatesManager.py


注:本文中的pxStats.lib.StatsDateLib.StatsDateLib.getCurrentTimeInIsoformat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。