datetime - time delta parameter in python script -


I am a novice user of Python 2.7 I have a script that produces a series of dates & amp; Timestamps and TimedText (relative to the previous date and timestep):

  2014-02-11 12: 11: 38.303000 0:00:00 2014-02-11 12:30 30: 36.851000 0: 18 : 58.548000 2014-02-11 13:58 58: 33.776000 1: 27: 56.925000 2014-02-11 14: 53: 49.193000 0: 55: 15.417000 2014-02-12 09: 32: 40.186000 18: 38: 50.993000 2014- 02 -12 09: 32: 40.187000 0: 00: 00.001000 2014-02-12 09:37: 50.535000 0: 05: 10.348000 2014-02-12 14: 00: 14.496000 4:22 22: 23.961000 2014-02-13 08:51 : 52.554000 18: 51: 38.058000 2014-02-13 09: 04: 47.179000 0: 12: 54.625000 2014-02-13 09: 05: 26.359000 0: 00: 39.180000  

I following Trying to add and implement functionality (using some example values ​​below User's defined value in (40000 = 40 seconds) last_timestamp = 2014-02-13 09: 04: 47.179000 current_timestamp = 2014-02-13 09: (

  time_immeter = 40000 # 05: 26.359000 Time_delta = 0: 00: 39.180000 if time_data> = Time_meters: state = "time expired": state = "on"  

My question is primarily to write this time-parameter so that the script can understand that it is using millisecond And I can use this value in the clause. I am practicing with a few different uses, but I am in frustration with finding solutions. There is hope to find some answers or guidance.

Thanks

Edit the notes:

Time Cal:

  lastdtts = "default" Looping through timestamp with: "14-02-11 08: 35: 41.526000" timestamp = line [0] dtts = datetime.strptime (timestamp, "% y-% m-% d% H:% M:% S .% F ") if lastdtts ==" default ": lastdtts = dtts tdelta = dtts-lastdtts lastdtts = dtts print"% s% s "% (dtts, tdelta) # 2014-02-13 09:05: 26.359000 0: 00: 39.180000  

if time_delta is type < Code> timedelta you can change the number of milliseconds to the same type:

  limit_msec = 40000 # User-defined values ​​in milliseconds limit_timedelta = timedelta (milliseconds = limit_msec)  

and then you can test it:

  if time_delta> = Limit_timedelta: state = "expired"  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -