View previous topic :: View next topic |
Author |
Message |
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Jul 24, 2003 3:07 pm Post subject: GetTickCount --> Get Time Since Windows was Started |
|
|
Thanks to SnarlingSheep for the calculations on turning milliseconds into
minutes
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 |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Mon Jul 28, 2003 11:13 am Post subject: |
|
|
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 |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Jul 28, 2003 2:27 pm Post subject: |
|
|
Nice. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sat Jan 10, 2004 4:59 am Post subject: |
|
|
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 |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Sat Jan 10, 2004 9:06 am Post subject: |
|
|
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 |
|
|
Hortalonus Valued Contributor
Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Mon Jan 12, 2004 7:11 pm Post subject: |
|
|
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.
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 |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Jan 12, 2004 8:00 pm Post subject: |
|
|
Nice. Now all that needs to be done is make a unit out of all of these. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
|
|
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
|
|