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


Python StatsDateLib.getHoursFromIso方法代碼示例

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


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

示例1: buildThisHoursFileName

# 需要導入模塊: from pxStats.lib.StatsDateLib import StatsDateLib [as 別名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getHoursFromIso [as 別名]
 def buildThisHoursFileName(  client = "someclient", offset = 0, currentTime = "", fileType = "tx", machine = "someMachineName" ):
     """ 
         @summary : Builds a filename using current currentTime.
         
         @Note : The format will be something like this :
                 StatsPaths.STATSPICKLES/clientName/date/TXorRX//machine_hour
                 Ex : StatsPaths.STATSPICKLES/clientName/20060707/tx/machinex_12:00:00
         
                 offset can be used to find a file from an hour close to the current one 
         
                 tempcurrentTime can also be used to build a filename from another hour. 
         
         
         @warning :To be used only with pickles created hourly.
             
     """    
     
     timeFolder = ""
            
     if currentTime == "":
         currentTime = time.time()
     else:
         currentTime = StatsDateLib.getSecondsSinceEpoch( currentTime )    
     
     currentTime = currentTime + ( offset * StatsDateLib.HOUR )
     splitTime = time.gmtime( currentTime )    
             
     for i in range( 3 ):
         
         if int( splitTime[i] ) < 10 :
             timeFolder = timeFolder + "0" + str( splitTime[i] )
         else:
             timeFolder = timeFolder + str( splitTime[i] )          
     
             
     hour = StatsDateLib.getHoursFromIso( StatsDateLib.getIsoFromEpoch( currentTime ) )
     
     maxLt = ( os.statvfs( STATSPATHS.STATSPICKLES )[statvfs.F_NAMEMAX])
     
     fileName = ( "%s" + "%." +  str( maxLt ) + "s/%s/%s/%." + str( maxLt ) + "s_%s" )   %( STATSPATHS.STATSPICKLES, client, timeFolder,  fileType, str(machine),  str(hour) )  
             
     return fileName 
開發者ID:hawkeye438,項目名稱:metpx,代碼行數:44,代碼來源:StatsPickler.py


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