473,480 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

inaccuracy in the time module

alf
Hi,

can someone explane this:
>>from time import *
timezone
18000

>>t=time()
mktime(gmtime(t))-t
17999.680048942566
why there is a difference?

--
alf
Sep 4 '06 #1
2 1228
alf <ask@mewrites:
>>t=time()
>>mktime(gmtime(t))-t
17999.680048942566
why there is a difference?
time() is a floating point number with fractional seconds.
gmtime()'s resolution is one second.
Sep 4 '06 #2
alf
Paul Rubin wrote:
alf <ask@mewrites:
>>t=time()
mktime(gmtime(t))-t
17999.680048942566
why there is a difference?


time() is a floating point number with fractional seconds.
gmtime()'s resolution is one second.
thx, got it now. replacing with "t=round(time())" fixes the problem.

--
Andy
Sep 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
9421
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
1
1644
by: Dennis Benzinger | last post by:
I just played around with the new timeit module. Using the following code I get some strange results: import timeit def test(s): result = 0 for c in s: result += ord(c) return result
2
1291
by: Sean Berry | last post by:
I was writing a little script to test different functions of the time module. Like an idiot, I named the test script time.py. Then when I tried to do a "import time" call, I got an error. So,...
0
1158
by: François Pinard | last post by:
Hi, everybody. I wish someone could advise me. I'm running in circles, trying to find an elegant way to devise run-time pluggable classes. It all goes around method resolution order, I guess....
3
2011
by: cj | last post by:
If I want to check to see if it's after "11:36 pm" what would I write? I'm sure it's easy but I'm getting tired of having to work with dates and times. Sometimes I just want time or date. And...
1
1390
by: Brian Quinlan | last post by:
I have a misinformed theory that I'd like to share with the list. I believe that profiler calibration no longer makes sense in Python 2.4 because C functions are tracked and they have a different...
7
8524
by: flupke | last post by:
Hi, i'm getting errors with the log module concerning RotatingFileHandler. I'm using Python 2.4.3 on Windows XP SP2. This used to work in previous python versions but since i upgraded to 2.4.3...
6
1668
by: DarkBlue | last post by:
My application makes several connections to a remote database server via tcp/ip. Usually all is fine,but occasionally the server is down or the internet does not work and then there is the 30 sec...
6
1482
by: lorlarz | last post by:
Regarding http://mynichecomputing.com/digitallearning/yourOwn.htm and how to make it fail when it should not with an integer OR parseInt to integer conversion problem. THE real problem IS is...
0
7037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7076
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5321
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4767
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4471
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2990
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.