forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


GetTickCount --> Get Time Since Windows was Started

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code
View previous topic :: View next topic  
Author Message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Thu Jul 24, 2003 3:07 pm    Post subject: GetTickCount --> Get Time Since Windows was Started Reply with quote

Thanks to SnarlingSheep for the calculations on turning milliseconds into
minutes Smile

Code:
LOADLIB kernel32.dll
%A = @lib(kernel32,GetTickCount,INT:)
info Windows was started: @FORMAT(@FDIV(@FDIV(%A,1000),60),.2) Minutes Ago.
FREELIB kernel32.dll

_________________
FreezingFire
VDSWORLD.com
Site Admin Team


Last edited by FreezingFire on Fri Jan 09, 2004 10:29 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Mon Jul 28, 2003 11:13 am    Post subject: Reply with quote

This call is also great for timing processes etc. Like this:

Code:
LOADLIB kernel32.dll
%%start = @lib(kernel32,GetTickCount,INT:)
wait 2
%%end = @lib(kernel32,GetTickCount,INT:)
%%elapsed = @fdiv(@fsub(%%end,%%start),1000)
FREELIB kernel32.dll
info Time elapsed: %%elapsed secs!


Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Mon Jul 28, 2003 2:27 pm    Post subject: Reply with quote

Nice. Smile
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Sat Jan 10, 2004 4:59 am    Post subject: Reply with quote

hi ff,

i have amended your code to display the info in hours and minutes...i simply needed to and i thought of sharing what i did with others

Code:
LOADLIB kernel32.dll
  %A = @lib(kernel32,GetTickCount,INT:)
  %%time = @FDIV(@FDIV(%A,1000),60)
  %%hours = @fdiv(%%time,60)
  %%minutes = @fmul(@frac(%%hours),60)
  info Windows has been running for @format(%%hours,.0) hours and @format(%%minutes,.0) minutes.
  FREELIB kernel32.dll


i can add seconds if any one is interested in knowing how long windows has been running to the second...let me know!

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Sat Jan 10, 2004 9:06 am    Post subject: Reply with quote

You may go into the millisecs, of course.

Funny thing is that there are so many ways of doing the math involved in this little calculation...
Here is a very transparent way of doing it:

Code:

  option decimalsep,.
  REM Define units in Msecs
  %%onehour = @prod(@prod(60,60),1000)
  %%onemin = @prod(60,1000)
  %%onesec = @prod(1,1000)
 
  LOADLIB kernel32.dll
  %A = @lib(kernel32,GetTickCount,INT:)
  %%hours = @div(%A,%%onehour)
  %%rest = @mod(%A,%%onehour)
  %%mins = @div(%%rest,%%onemin)
  %%rest = @mod(%%rest,%%onemin)
  %%secs = @div(%%rest,%%onesec)
  %%msecs = @mod(%%rest,%%onesec)
  info Windows has been running for %%hours" hours, "%%mins minutes", "%%secs seconds", and "%%msecs milliseconds.
  FREELIB kernel32.dll


Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Mon Jan 12, 2004 7:11 pm    Post subject: Reply with quote

Don't forget days... rumor has it that at least one computer running Microsoft Windows has been documented as being up for more than 24 continuous hours without rebooting. Wink

Code:
OPTION DECIMALSEP,.
%%onesec = @PROD(1,1000)
%%onemin = @PROD(60,%%onesec)
%%onehour = @PROD(60,%%onemin)
%%oneday = @PROD(24,%%onehour)
 
LOADLIB kernel32.dll
%A = @LIB(kernel32,GetTickCount,INT:)
FREELIB kernel32.dll

%%days = @DIV(%A,%%oneday)
%%rest = @MOD(%A,%%oneday)
%%hours = @DIV(%A,%%onehour)
%%rest = @MOD(%A,%%onehour)
%%mins = @DIV(%%rest,%%onemin)
%%rest = @MOD(%%rest,%%onemin)
%%secs = @DIV(%%rest,%%onesec)
%%msecs = @MOD(%%rest,%%onesec)

INFO "Windows has been running for "%%days" days, "%%hours" hours, "%%mins" minutes, "%%secs" seconds, and "%%msecs" milliseconds."
EXIT

_________________
"ah, come take my hand... we're ridin' out tonight to face the promised land"
Get a free iPod mp3 player...
Back to top
View user's profile Send private message Send e-mail
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Mon Jan 12, 2004 8:00 pm    Post subject: Reply with quote

Nice. Now all that needs to be done is make a unit out of all of these. Wink
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group