LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-10-2005, 01:52 PM   #1
os2
Member
 
Registered: Dec 2003
Location: Canada
Distribution: openSUSE Tumbleweed
Posts: 209

Rep: Reputation: 30
negatif time...


hi


Code:
parseDate(&prod->tmbEndRun, date_rtu);   
parseTime(&prod->tmbEndRun, prod->htime_rtu_fin);           
printf("end %s\n", prod->htime_rtu_fin);
return me

Quote:
05/06/10
end 14:24:28

Code:
parseDate(&prod->tmbStartRun, date_rtu);   
parseTime(&prod->tmbStartRun, hactual_time);
return me

Quote:
05/06/10
start 14:31:03
now i would like to have duration between us....

Code:
prod->timeEndRun=mktime(&prod->tmbEndRun);
prod->timeStartRun=mktime(&prod->tmbStartRun);
prod->stopRun = difftime(prod->timeStartRun, prod->timeEndRun);

printf("stop run: %d %ld %ld\n",prod->stopRun, prod->timeStartRun, prod->timeEndRun);
that return me
stop run: -3205 1118428263 1118431468

why prod->timeStartRun (14:31:03) is smaller then prod->timeEndRun (14:24:28)?


thanks
 
Old 06-12-2005, 02:26 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
The values are correct, but difftime returns double which doesn't print well with %d. %f should be better.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Doub about `net time set` and daylight saving time Thakowbbery Linux - Software 0 10-17-2005 05:23 AM
ps2 mouse freezing on FC1/FC2 from time to time farpoint Linux - Hardware 5 08-14-2005 02:20 PM
Long Time Reader - 1st Time Poster prissed LinuxQuestions.org Member Intro 1 08-10-2004 11:13 AM
no signal when starting xorg for the 1st time (but the second time works fine) bungalowbill Linux - Software 0 06-04-2004 09:56 AM
Setting System Time: kernel in wrong time zone warrenweiss Linux - General 7 05-15-2004 03:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration