python::GBSTimeStamp Namespace Reference


Functions

def GBSTimeStamp
def TimeStampToUnixTime
def UnixTimeToTimeStamp


Function Documentation

def python::GBSTimeStamp::GBSTimeStamp (  ) 

Standard timestamp corresponding to the current time.

Definition at line 5 of file GBSTimeStamp.py.

00005                   :
00006     """Standard timestamp corresponding to the current time."""
00007     return datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S ')
00008 
def TimeStampToUnixTime(time_stamp):

def python::GBSTimeStamp::TimeStampToUnixTime (   time_stamp  ) 

Convert time stamp string (with optional time component) to Unix time.

Definition at line 9 of file GBSTimeStamp.py.

00009                                    :
00010     """Convert time stamp string (with optional time component) to Unix time."""
00011     try: return time.mktime(time.strptime(time_stamp,"%Y-%m-%d %H:%M:%S"))
00012     except:
00013         try: return time.mktime(time.strptime(time_stamp,"%Y-%m-%d"))
00014         except:
00015             print "TimeStampToUnixTime: invalid time stamp:" + str(time_stamp)
00016             return None
00017 
def UnixTimeToTimeStamp(unix_time):

def python::GBSTimeStamp::UnixTimeToTimeStamp (   unix_time  ) 

Convert Unix time to time stamp string.

Definition at line 18 of file GBSTimeStamp.py.

00018                                   :
00019     """Convert Unix time to time stamp string."""
00020     try: return datetime.datetime.fromtimestamp(unix_time).strftime("%Y-%m-%d %H:%M:%S")
00021     except:
00022         print "UnixTimeToTimeStamp: invalid Unix time " + str(unix_time)
00023         return None
        return None


Generated on Fri Mar 5 09:25:41 2010 for gbs by  doxygen 1.4.7