Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TDateTime and the system clock

Status
Not open for further replies.

Ruggie

Programmer
Aug 2, 2003
46
US
I'm trying to take a TDateTime Value (like 38073.1164814815, converts to something like 3/27/2004 2:48:43 AM)
and I need to set that date and time value to the system clock.

I know of no functions to set the system time in windows, I did check around and found a function settime but it only accepts std::time and I don't know how to convert a TDateTime because I know nothing about the std::time value.

If you know of a way to set the system clock using the TDateTime or of a way to convert TDateTime to std::time then please let me know!

Thank you,
Ruggie

P.S. - Using Borland C++ Builder 6 if it helps.
 
Look at DateTimeToSystemTime.

James P. Cottingham

There's no place like 127.0.0.1.
There's no place like 127.0.0.1.
 
Thanks!

I figured out how to convert a TDateTime to std::time but noticed everytime I used the settime and gettime functions for a while a memory leak would eat up all system memory.

But the SystemTime is much better to work with, the function SetSystemTime accepts TDateTimes and its easy to convert SystemTime to TDateTime!

Not to mention there has been no memory leaks with the SystemTime code.

Thanks again!

-Ruggie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top