flat assembler
Message board for the users of flat assembler.
Index
> Windows > UpTime |
Author |
|
Yardman 14 Jan 2012, 08:53
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 04:37; edited 3 times in total |
|||
14 Jan 2012, 08:53 |
|
DOS386 15 Jan 2012, 04:52
> Some newer API's which may be interesting...
> GetTickCount64 Added in Vista but should have been in (the CPU ?) since the beginning > Some things to maybe consider, hibernation time and what happens after ~50 days One more: http://en.wikipedia.org/wiki/Leap_second _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
15 Jan 2012, 04:52 |
|
Yardman 16 Jan 2012, 01:30
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 04:37; edited 1 time in total |
|||
16 Jan 2012, 01:30 |
|
Alphonso 16 Jan 2012, 03:51
Yardman wrote: Alphonso,I suppose that 64 bit progamming is here. A good idea IMO, but you can run both those API's with 32-bit. A rough example Code: format PE GUI 6.0 ; Vista and up include 'win32a.inc' sub esp,100h ; Buffer mov ebp,esp invoke GetTickCount64 ; 64bit value returned in EDX:EAX mov ebx,1000 call div64 mov [ebp],ecx ; msecs mov ebx,60 call div64 mov [ebp+4],ecx ; sec call div64 mov [ebp+8],ecx ; mins mov ebx,24 call div64 mov [ebp+0ch],ecx ; hrs mov [ebp+10h],edx ; lots of days! mov [ebp+14h],eax ; days lea ebx,[ebp+18h] ; Print buffer cinvoke wsprintf,ebx,wsformat,[ebp+14h],[ebp+10h],[ebp+0ch],[ebp+8],[ebp+04h],[ebp] invoke MessageBoxA,0,ebx,Tit,MB_TOPMOST add esp,100h exit: invoke ExitProcess,0 ;------------------------ div64: push eax mov eax,edx xor edx,edx div ebx mov ecx,eax pop eax div ebx xchg edx,ecx ret ;------------------------ Tit db 'Up Time',0 wsformat db 'From reboot ',9,'%4I64u Days, %02u Hours %02u Mins, %02u.%03u Secs',0 data import library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL' import kernel32,\ GetTickCount64,'GetTickCount64',\ ExitProcess,'ExitProcess' import user32,\ wsprintf,'wsprintfA',\ MessageBoxA,'MessageBoxA' end data Not sure how leap time is relevant, for instance if the system has been running for 1 hour and a leap day occurs it is still 1 hour and not 25 hours. Should be good for ~584 million years of uptime lol. |
|||
16 Jan 2012, 03:51 |
|
revolution 16 Jan 2012, 03:59
Alphonso wrote: Not sure how leap time is relevant, for instance if the system has been running for 1 hour and a leap day occurs it is still 1 hour and not 25 hours. |
|||
16 Jan 2012, 03:59 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.