Fedora Linux Support Community & Resources Center
  #1  
Old 27th January 2012, 08:45 PM
mdberger Offline
Registered User
 
Join Date: Oct 2011
Posts: 64
windows_xp_2003firefox
Time Discrepency

On F16_64 in a complex C++ program, I first check the time with:

timespec ts_;
clock_gettime(CLOCK_REALTIME,&ts_);

and get:
15:33:00.000108220

A little later I check with:

time_t timeI;
time(&timeI);

and get:
15:32:59

Earlier! So what's happening?

Thanks for your help.
Mike.
Reply With Quote
  #2  
Old 28th January 2012, 01:09 AM
sea Offline
"Shells" (of a sub world)
 
Join Date: May 2011
Location: Confoederatio Helvetica (Swissh)
Age: 34
Posts: 3,487
linuxfedorafirefox
Re: Time Discrepency

Living in a country which switches the dayhours by 1 for winter and summer time, i'd guess one command get 'summertime' and the other reads the 'wintertime'.

Beeing confused?
One time is stored in bios, the other is displayed from system (whatever it may be), which stores your timezone and the according +/-X hr.
It then calculates the 'proper' time according to your settings done during installation.

My question to you is, why read the same value in 2 diffrent ways?
__________________
Laptop: Toshiba satellite p50-a-11 CPU: Intel i7 8*2400 MHz GPU: GeForce GT 745M RAM: 8192 MB Distro: Fedora (Rawhide) DE: Awesome
Text User Interface (TUI) // Windows 8+ & Fedora 20+ Dualboot
Reply With Quote
  #3  
Old 28th January 2012, 01:42 AM
mdberger Offline
Registered User
 
Join Date: Oct 2011
Posts: 64
windows_xp_2003firefox
Re: Time Discrepency

Summer vs. Winter? I don't think so; the difference is less than a second.

Why to I use two different time methods? Well first of all, I don't anymore,
so that problem is gone. On the other hand, one method provides nanoseconds,
and the other provides only seconds. I would think that where the high precision
is not required, the one that provides seconds would do; but I would expect
the seconds to be the same as the seconds part of the higher precision method.
I consider this failure a system bug.

I find it hard to believe that one queries the system, and the other queries
the bios. If this is true, that this in itself looks like a design error. On the
other hand, the higher precision requires specification of a clock
clock_gettime(CLOCK_REALTIME) which man says returns the time since
the epoch. man 3 time says the same thing for time, but I don't see
anything there about CLOCK_REALTIME. Perhaps it is some other clock?

Mike.
Reply With Quote
Reply

Tags
discrepency, time

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The system date and time is changing automatically, even after I set the correct time siva Using Fedora 8 31st July 2010 03:07 PM
Fedora 8 dual boot with Windows XP [Pavilion dv6137tx] Time gets reset every time! maverick280857 Hardware & Laptops 5 23rd March 2008 11:48 AM
FC5 light blue stripes all over the desktop from time to time paidopoieo Using Fedora 4 10th May 2006 04:36 PM


Current GMT-time: 10:17 (Friday, 24-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Sensuntepeque Instagram Photos - Dhamtari - Tolu Photos