Valhalla Legends Forums Archive | Battle.net Bot Development | ctime representation in Visual Basic

AuthorMessageTime
Spht
Since it looks like UserLoser has this done wrong in his WebChannel client, I figured I'd post the correct calculation here.

Hex(21600 + 3600 * Hour(Now) + 60 * Minute(Now) + Second(Now))

(converted to hex per to WebChannel specification)
September 30, 2003, 1:44 AM
iago
is "now" a variable or a function? If it's a function, you should store it in a variable and use the variable in place of "now". :-)
September 30, 2003, 12:49 PM
UserLoser
Hehe, thanks also ;)

Now returns the current system date and time i.e.: 9/30/2003 3:41:07 PM
September 30, 2003, 8:37 PM
iago
But it's probably a function, not a variable, so calling it many times is baad! :)
September 30, 2003, 9:42 PM
Adron
Actually it's very bad, in case the value changes between two calls. If you get the hour from 12:00:00 and the other data from 11:59:59, you'll be off....

Also, ctime? What's that? I thought ctime was a string representation of a time_t..
October 2, 2003, 8:31 PM
Kp
[quote author=Adron link=board=17;threadid=2891;start=0#msg22839 date=1065126716]Also, ctime? What's that? I thought ctime was a string representation of a time_t..[/quote]It is! I think there was a documentation error. What should have been written was the time(2) format (as opposed to GetTickCount (), GetSystemTime (), or other Windows specific time specifiers (yes, I know GTC would be horribly inappropriate even if you did want something Windows specific)).
October 2, 2003, 9:35 PM
Adron
That's supposed to be seconds since 1970 though? How is that ever going to work out if you only pass in hour, minute and second??
October 2, 2003, 10:16 PM
Skywing
[quote author=Adron link=board=17;threadid=2891;start=0#msg22852 date=1065133009]
That's supposed to be seconds since 1970 though? How is that ever going to work out if you only pass in hour, minute and second??
[/quote]
He is taking advantage of the fact that the current BinaryChatISAPI implementation only uses the ctime provided as a timestamp. Eventually, datestamping may be introduced, in which case this code will not work at all.
October 3, 2003, 3:05 AM
Spht
[quote author=Skywing link=board=17;threadid=2891;start=0#msg22888 date=1065150349]
[quote author=Adron link=board=17;threadid=2891;start=0#msg22852 date=1065133009]
That's supposed to be seconds since 1970 though? How is that ever going to work out if you only pass in hour, minute and second??
[/quote]
He is taking advantage of the fact that the current BinaryChatISAPI implementation only uses the ctime provided as a timestamp. Eventually, datestamping may be introduced, in which case this code will not work at all.
[/quote]

Neat. When are you planning on adding this so I can get a head-start with future releases of WebBot?
October 3, 2003, 3:14 AM

Search