mIRC Home    About    Download    Register    News    Help

Print Thread
$ctime, SYSTEMTIME and FILETIME #151676 20/06/06 09:25 AM
Joined: Jan 2003
Posts: 98
T
twigboy Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Jan 2003
Posts: 98
hey, im new to the whole time calculation thing (and i hate it very much). this is for the calendar control for DCX

i tried searching the threads before asking, and the only relevant thread i found was somewhat confusing
http://forums.mirc.com/s...=true#Post40423

i understand that SYSTEMTIME needs to be converted to FILETIME, but that is a 64bit number.
im not quite sure how that is calculated into a value such as $ctime, which mIRC scripts can process easily

any help would be appreciated
(please dont send me links to msdn, ive browsed that enough and dont really understand it as it is)

Re: $ctime, SYSTEMTIME and FILETIME #151677 20/06/06 12:50 PM
Joined: Jan 2003
Posts: 1,063
D
Doqnach Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
why not use the 32bits time_t struct? O_o

http://www.cplusplus.com/ref/ctime/ctime.html

you don't need the time units of a file right? just dates?


If it ain't broken, don't fix it!
Re: $ctime, SYSTEMTIME and FILETIME #151678 20/06/06 12:58 PM
Joined: Jan 2003
Posts: 98
T
twigboy Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Jan 2003
Posts: 98
hmm, well i still have the problem of converting the SYSTEMTIME format into the time_t format

its just the way that the WinApi retreives the selected date from the MonthCal control

Re: $ctime, SYSTEMTIME and FILETIME #151679 21/06/06 09:54 AM
Joined: Jan 2003
Posts: 1,063
D
Doqnach Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
if I read everything right, you can use the SYSTEMTIME struct and the mktime() function to convert it to a time_t struct...

there is an MFC CTime class too... so if you use MFC you can use that aswell

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/systemtime_str.asp

http://msdn.microsoft.com/library/defaul...colcolctime.asp


If it ain't broken, don't fix it!
Re: $ctime, SYSTEMTIME and FILETIME #151680 21/06/06 10:14 AM
Joined: Jan 2003
Posts: 98
T
twigboy Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Jan 2003
Posts: 98
yeah i've read up on it, but it still doesnt really give me much of a clue on how to do this

mktime requires a "tm" structure, and returns a "tm" struct
conversion between these formats are a pain! =(

Re: $ctime, SYSTEMTIME and FILETIME #151681 26/06/06 06:43 PM
Joined: Jan 2003
Posts: 1,063
D
Doqnach Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
you can use localtime or gmtime to convert from unix timestamp to tm struct


If it ain't broken, don't fix it!