Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Spht on September 29, 2003, 08:44 PM

Title: ctime representation in Visual Basic
Post by: Spht on September 29, 2003, 08:44 PM
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)
Title: Re:ctime representation in Visual Basic
Post by: iago on September 30, 2003, 07:49 AM
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". :-)
Title: Re:ctime representation in Visual Basic
Post by: UserLoser on September 30, 2003, 03:37 PM
Hehe, thanks also ;)

Now returns the current system date and time i.e.: 9/30/2003 3:41:07 PM
Title: Re:ctime representation in Visual Basic
Post by: iago on September 30, 2003, 04:42 PM
But it's probably a function, not a variable, so calling it many times is baad! :)
Title: Re:ctime representation in Visual Basic
Post by: Adron on October 02, 2003, 03:31 PM
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..
Title: Re:ctime representation in Visual Basic
Post by: Kp on October 02, 2003, 04:35 PM
Quote from: Adron on October 02, 2003, 03:31 PMAlso, ctime? What's that? I thought ctime was a string representation of a time_t..
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)).
Title: Re:ctime representation in Visual Basic
Post by: Adron on October 02, 2003, 05:16 PM
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??
Title: Re:ctime representation in Visual Basic
Post by: Skywing on October 02, 2003, 10:05 PM
Quote from: Adron on October 02, 2003, 05:16 PM
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??
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.
Title: Re:ctime representation in Visual Basic
Post by: Spht on October 02, 2003, 10:14 PM
Quote from: Skywing on October 02, 2003, 10:05 PM
Quote from: Adron on October 02, 2003, 05:16 PM
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??
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.

Neat. When are you planning on adding this so I can get a head-start with future releases of WebBot?