flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3 Next |
Author |
|
baldr 18 Mar 2010, 16:07
a115433,
Aha, 2³² times longer (Good catch! Universe probably collapse significantly before the overflow. ![]() ![]() Pretend to be an astronomer and use Julian dates. ![]() |
|||
![]() |
|
LocoDelAssembly 18 Mar 2010, 16:17
Quote:
Little? WTF, little??? Well, no one felt tempted to answer your previous questions so here they go: >And you think this 50 days is really 50 days? No, it is ~49.71 days. >What if i change frequency of power supply, so realtime clock will go faster? Power supply frequency? Is this CPU frequency maybe? The real-time clock has little to do with this AFAIK, here it is used the PIT/APIC timer (or whatever is used in modern PCs) to keep the counting. Probably some error still exists but I would be very surprised if it is too gross. >What if i do something with clock itself? GetTickCount spec would be violated, it has to count milliseconds, not whatever a naughty driver decided by changing the hardware timer without notifying the kernel. The same applies to processors supporting a fixed rate TSC, some driver could reset the counter making the illusion that hundreds years passed in a matter of nanoseconds. >What if i manage to get on top secret military server, hang the application between GetTickCount() exactly -1 microseconds, so both calls return same value? And the next code will behave diffrently after it? For example divide by 0 (maybe in module responsible for logging statistics)? No one will notice in 50 days that? Then I'm very thankful of the "design error", those guys really deserve the crash for those tons of incompetence. |
|||
![]() |
|
baldr 18 Mar 2010, 16:21
LocoDelAssembly,
What if god wakes from the eternal sleep and ~universe before the second call to GetTickCount()? That will ruin the entire algorithm! ![]() "They've killed Kenny!" — "You bastards!" ![]() Last edited by baldr on 18 Mar 2010, 16:27; edited 1 time in total |
|||
![]() |
|
revolution 18 Mar 2010, 16:26
Yeah! We need GetTickCount4294967296(). I won't settle for anything less.
|
|||
![]() |
|
baldr 18 Mar 2010, 16:30
revolution,
About to have "that doesn't compute" error. Quantum states of all particles in the universe don't seem to hold such a counter. ![]() |
|||
![]() |
|
edfed 18 Mar 2010, 16:33
![]() |
|||
![]() |
|
baldr 18 Mar 2010, 16:39
Limits are as such, limits. When you don't care about them, they're striking back.
|
|||
![]() |
|
revolution 18 Mar 2010, 16:55
baldr wrote: revolution, |
|||
![]() |
|
baldr 18 Mar 2010, 17:10
revolution,
Damn, I thought about 2↑↑32. That happens. |
|||
![]() |
|
revolution 19 Mar 2010, 07:14
baldr wrote: Damn, I thought about 2↑↑32. That happens. If so, then that is an awfully big number! We could count sub-yocto-yocto-yocto-yocto-Planck times and still not run out of bits to count with for the foreseeable future. |
|||
![]() |
|
Fanael 19 Mar 2010, 08:22
revolution wrote:
![]() |
|||
![]() |
|
edfed 19 Mar 2010, 08:49
getdatetimetick()
maybe it can be better. with the format like this: YYYY/MM/DD ; hh:mm:ss:tick 16bits/4bits/5bits ; 5bits/6bits/6bits/10bits then, without any problem, i can say only 52bits are largelly enough to gettickcount until the year 65536. assuming tick resolution is 1millisecond and year starting at jesus birth. when getting time, don't forget to get the date, to see if there are overflows. thats what i name good coding. |
|||
![]() |
|
baldr 19 Mar 2010, 08:58
revolution,
Yes, that's D. E. Knuth arrow. I thought of it first because such counter will probably satisfy a115433's needs. __________ Fanael, Is Graham's number big enough? ![]() __________ edfed, B.C. dates should be available too. What about year 0? ![]() |
|||
![]() |
|
revolution 19 Mar 2010, 09:18
edfed wrote: ... until the year 65536. |
|||
![]() |
|
edfed 19 Mar 2010, 10:01
lol, we can troll about that a very long time, at least 30757 more years
![]() |
|||
![]() |
|
DOS386 19 Mar 2010, 10:07
baldr wrote: There is GetTickCount64() (Vista/2008+) ![]() ![]() ![]() |
|||
![]() |
|
Fanael 19 Mar 2010, 10:35
baldr wrote: Fanael, ![]() |
|||
![]() |
|
edfed 19 Mar 2010, 13:10
lol, win98 cannot gives years over 2099 and under 1985.
i cannot creates files at my day of born. and if i live that long, i hope i'll have my own OS. ![]() what i like on this board is that we don't stop to feed the trolls, we feed him so much that he becomes ill and fed up. ![]() |
|||
![]() |
|
a115433 19 Mar 2010, 14:08
nonononono
resolution is not important! make 100 functions GetTickCount(), GetTickCount2(), GetTickCount4(), etc... But let each of them return error in case of overflow! Quote: >And you think this 50 days is really 50 days? GetTickCount() has the resolution of unsigned 32 bits, that is: 4294967295 miliseconds wich is 4294967 (+ .295) seconds its 1193 (+ .0464708(3)) hours. since x86 allow only 32 bits, (3) is rounded down to 3. 1193 (+ .04647083) hours and it is 49.71026961791(6). since (6) cant fit into limited register, round up to 7, and we have maximum abbount of days that can pass between 2 effective (actual read from counter) calls of GetTickCount() = 49.710269617917 days. And thats assuming in calculations we used modulo from DX. |
|||
![]() |
|
Goto page Previous 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.