[Tutor] Time - sum/difference

Jonas Melian jonasmg at SoftHome.net
Mon Oct 24 18:02:53 CEST 2005


Anyway, I found a library for working with time zones
http://pytz.sourceforge.net/

Hugo González Monteverde wrote:

> What I usually do is convert them all to UNIX epoch and then substact 
> the values in seconds:
>
> >>> import time
> >>> early = time.time()
> >>> sleep(5)
> >>> time.sleep(5)
> >>> late = time.time()
> >>> print late - early
> 5.7889997959
> >>>
>
>
> Jonas Melian wrote:
>
>> I would get the local time of a country, using UTC (Universal Time 
>> Coordinated) and DST (Daylight SavingTime) of that country.
>>
>> An example, utc time -02:30 and dst +1 :
>>
>> country_utc = datetime.time(2,30)
>> isUTCNegative = True
>> dst = datetime.time(1,0)
>>
>> Now I would the difference of both times.
>> -02:30 + 01:00 -> -01:30
>>
>> Is possible get sum/difference of time values? How?
>>
>> Thanks in advance
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> http://mail.python.org/mailman/listinfo/tutor
>>
>



More information about the Tutor mailing list