MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey-v1.0 / MyGetTickCount

Method MyGetTickCount

Source/script.cpp:10407–10426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10405
10406
10407VarSizeType Script::MyGetTickCount(char *aBuf)
10408{
10409 // UPDATE: The below comments are now obsolete in light of having switched over to
10410 // using 64-bit integers (which aren't that much slower than 32-bit on 32-bit hardware):
10411 // Known limitation:
10412 // Although TickCount is an unsigned value, I'm not sure that our EnvSub command
10413 // will properly be able to compare two tick-counts if either value is larger than
10414 // INT_MAX. So if the system has been up for more than about 25 days, there might be
10415 // problems if the user tries compare two tick-counts in the script using EnvSub.
10416 // UPDATE: It seems better to store all unsigned values as signed within script
10417 // variables. Otherwise, when the var's value is next accessed and converted using
10418 // ATOI(), the outcome won't be as useful. In other words, since the negative value
10419 // will be properly converted by ATOI(), comparing two negative tickcounts works
10420 // correctly (confirmed). Even if one of them is negative and the other positive,
10421 // it will probably work correctly due to the nature of implicit unsigned math.
10422 // Thus, we use %d vs. %u in the snprintf() call below.
10423 if (!aBuf)
10424 return MAX_NUMBER_LENGTH; // Especially in this case, since tick might change between 1st & 2nd calls.
10425 return (VarSizeType)strlen(ITOA64(GetTickCount(), aBuf));
10426}
10427
10428
10429

Callers 1

GetMethod · 0.80

Calls 1

ITOA64Function · 0.85

Tested by

no test coverage detected