• Welcome to Valhalla Legends Archive.
 

ctime representation in Visual Basic

Started by Spht, September 29, 2003, 08:44 PM

Previous topic - Next topic

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)

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". :-)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


UserLoser

#2
Hehe, thanks also ;)

Now returns the current system date and time i.e.: 9/30/2003 3:41:07 PM

iago

But it's probably a function, not a variable, so calling it many times is baad! :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


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..

Kp

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)).
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

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??

Skywing

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.

Spht

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?