[docs] PYTHON Principal error - loss of coherence - observed in modules time, datetime

Sandro Tosi sandro.tosi at gmail.com
Mon Oct 31 18:46:23 CET 2011


Hello Michal,
thanks for your detailed email. This mailing list, though, is about
Python documentation while it seems to me you need a bit more than
that; so I suggest to contact the python-list mailing-list at
http://mail.python.org/mailman/listinfo/python-list

Regards,
Sandro

On Fri, Oct 21, 2011 at 17:10,  <michal.sourek at centrum.cz> wrote:
> Dear sirs,
>
>         first,
>
>         let me express a highest level of admiration for all the genuine
> people involved in Python world
>
>
>
>         second,
>
>         please forgive me, as an "informed amateur", to direct this notice
> to you, instead of may-be a specialised dev/error team
>
>
>
>         third,
>
>         might be, that this piece of information has already been handled in
> some other bug/error/PEP
>
>
>
> after some years spent with Python
>
> I´ve observed recently an incoherence - a feature in time / datetime
> modules,
>
> that,
>
> in a fair belief,
>
> both should and can be handled
>
> so that the function are coherent - meaning the "promised" behaviour keeps
> really "being delivered" even under bellow-described circumstances, that are
> quite common in recent years
>
>
>
> In a hope
>
> this can help
>
> please forward the not to the appropriate hands
>
> and let me know if it did help - thank you
>
>
>
>
>
> With respect
>
> Michal
>
>
>
> use scenario: a procedure loopLineDATA( anObj ) ...demo-ed bellow ... gets
> an object to monitor
>
> and each 10-secs performs regular processing,
>
> it uses several about-one-second time.sleep()-s to wait till next
> 10-sec-time-period
>
>
>
> the point: as gets up and running ( loop forever )
>
> it prints every 10 secs a "status-report" on time/data
>
> and
>
> once
>
> a notebook gets "hibernated" .. a quite often state ( be it a power saving
> policy, or an intention )
>
> the process persists in some state throughout the hibernation epoch
>
> and after the notebook gets re-activated, the process continues
>
>
>
> the issue / non-conformity-note [NCN]
>
> The [NCN] claims,
>
> that after continuing the processing ( post-hibernation state ),
>
> Python displays [ uses and displays ]
>
> wrong time values (as if no hibernation epoch did appear  ... continuing
> second-by-second right ahead from "old"-time of the moment, when the machine
> turned hibernated )
>
> the hibenrated-time-shift is correctly reported by machine clock,
>
> but not in the Python time / datetime functions - those keep continue
> counting time as if there were no hibernate-epoch ( areal-wolrd time-shift )
> in the meantime
>
>
>
> an interim fix: to prevent such, perform
>
> at some reasonable frequency, to keep low latency/overhead thereof,
>
> time-base re-adjustment to renew the coherence of Python-time with the
> machine RTC-clock (real-world-time)
>
>
>
> " /*-------------------------------------------------------------------
>
> # a demonstration sample ... not any kind of an optimised / HiPerf code :o)
>
> import time, datetime
>
> def loopLineDATA ( anObj )
>
> last_N = 0
>
> while True:
>
> try:
>
> now = datetime.datetime.now()
>
> ntt = now.timetuple()
>
> N   = ntt.tm_sec
>
> if ( N % 10 ) == 0: # to get 00 10 20 30 .. 50 "round-values"
>
> if N/ 10 == last_N: # to sleep/loop, should still in the
> "same-10-sec-time-period"
>
> time.sleep( 0.95 ) # to provide system a slight time-elasticity
> for SIG/overhead processing
>
> else:
>
> last_N = N / 10 # shuffle N as "10-sec-time-period" << { 0 1 2 3 4 5 }
>
> print now
>
> ''' process telemetry data -----
>
>
>
>     (skipped for clarity) ------
>
> '''
>
> except: Keyboard Interrupt:
>
> ''' clear contexts / RET '''
>
> return
>
> " */--------------------------------------------------------------------
>
> _______________________________________________
> docs mailing list
> docs at python.org
> http://mail.python.org/mailman/listinfo/docs
>
>



-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi


More information about the docs mailing list