Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Time difference
Time difference [message #17254] Mon, 04 August 2008 23:24 Go to previous message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
I have been using time difference to calculate time difference. I wanted to use a simple subtraction operation to subtract 1 hour from the current time.
Time t1 = GetSysTime();
Time dec(0,0,0,1,0,0);
Time res;
res.Set(t1-dec);

Cout() << "Time: " << AsString(t1) << "\n";
Cout() << "Time: " << AsString(res) << "\n";
Cout() << "Time: " << AsString(dec) << "\n";

result:
Time: 08/04/2008 17:27:22
Dec: 00/00/   0 01:00:00
Res: 07/04/2008 16:27:22

I was expecting 08/04/2008 16:27:22 and not 07/04/2008 16:27:22

Is Time not meant to be used in this way?

What if I specified it as:
Time dec(1900,1,1,1,0,0);
?

[Updated on: Mon, 04 August 2008 23:59]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: creating path
Next Topic: Drag & Drop Sample Size
Goto Forum:
  


Current Time: Fri May 10 12:45:21 CEST 2024

Total time taken to generate the page: 0.02463 seconds