Python Implementation of ref time

From PeformIQ Upgrade
Revision as of 18:56, 30 April 2008 by PeterHarding (talk | contribs) (New page: <pre> #===================================================================== def the_time(): t = float(ref_time(FALSE)) * 0.001 return t #-----------------------------------------...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#=====================================================================

def the_time():
   t = float(ref_time(FALSE)) * 0.001

   return t

#---------------------------------------------------------------------

def ref_time(flg):
   global start

   curr = datetime.now()

   if (flg):
      start  = curr
      t      = 0
   else:
      microsecond = (curr.microsecond - start.microsecond)
      second      = ((curr.second     - start.second) * 1000000)
      t           = (second + microsecond)/1000

   return t

#=====================================================================