Questions tagged [gettickcount]

GetTickCount() is a function in the Windows API that retrieves the number of milliseconds that have elapsed since the computer started. Use this tag if you are having difficulties with this function, or have a question related to GetTickCount()

33 questions
36
votes
8 answers

Calculating the speed of routines?

What would be the best and most accurate way to determine how long it took to process a routine, such as a procedure of function? I ask because I am currently trying to optimize a few functions in my Application, when i test the changes it is hard…
user741875
9
votes
5 answers

GetTickCount function

I have a question regarding GetTickCount function, I have two calls to this function in my code with several commands between them and the function in both calls returns same count. i.e. var1 = GetTickCount(); code : : var2 = GetTickCount(); var1…
Leonid
  • 93
  • 1
  • 1
  • 3
7
votes
2 answers

Is there any C++ standard class/function which is similar to GetTickCount() on Windows?

unsigned int Tick = GetTickCount(); This code is running only on Windows, but I want to use the C++ Standard library so it can run elsewhere. I searched std::chrono, but I can't find a function like GetTickCount(). Do you know what I should use…
Joy Hyuk Lee
  • 756
  • 11
  • 22
6
votes
3 answers

Why GetTickCount and timeGetTime have different resolution?

By default, GetTickCount and timeGetTime has the same resolution -- 15.625ms, but after I call timeBeginPeriod(1), GetTickCount still updates every 15.625 ms, while timeGetTime does update every 1ms, Why is this? In Bug in waitable timers?, the…
ajaxhe
  • 571
  • 1
  • 5
  • 13
5
votes
2 answers

Hooking GetTickCount with C++

I'm not great at C++, more of a C# and PHP guy. I've been assigned a project that requires me to use GetTickCount and hooking into an application. I need some help as for some reason it's not working as planned... Here is the code for hooking, I…
E3pO
  • 493
  • 1
  • 9
  • 21
5
votes
6 answers

Environment.TickCount is not enough

I want to know on when was the last time the system was started. Environment.TickCount will work but it is breaking after 48-49 days because of the limitation of int. This is the code I've been using: Environment.TickCount & Int32.MaxValue Does…
codebased
  • 6,945
  • 9
  • 50
  • 84
4
votes
1 answer

Declaring external functions depending on whether they exist

I would like to declare an external function from the kernel32.dll library whose name is GetTickCount64. As far as I know, it is defined only in Vista and in later Windows versions. This means that when I define the function as follows: function…
Mariusz Schimke
  • 3,185
  • 8
  • 45
  • 63
2
votes
2 answers

FPS game ping implementation

I'm working on a FPS (first person shooter) game at the moment, I want to show player's ping in the game (Connection delay). But what is the best method to do this? First I thought to use GetTickCount64, but Get Tick Count is not precise: "The…
Dagob
  • 695
  • 1
  • 12
  • 23
2
votes
0 answers

C++ call to API function ::GetTickCount() jumps ~18 days

On a few Windows computers I have seen that two, on each other following, calls to ::GetTickCount() returns a difference of 1610619236 ms (around 18 days). This is not due to wrap around og int/unsigned int mismatch. I use Visual C++ 2015/2017. Has…
rauhe
  • 21
  • 2
2
votes
0 answers

Assembly uses CALL ESI 3 times on GetTickCount why?

Can someone explain why GetTickCount is called 3 times in a row when only one result is used? This isn't the whole function of assembly just the part which has GetTickCount many times. I don't think it's human error in programming who would do that?…
user3435580
  • 566
  • 1
  • 4
  • 15
1
vote
8 answers

Elapsed Time with Environment.TickCount() - Avoiding the wrap

Does the absolute value protect the following code from the Environment.TickCount wrap? If Math.Abs((Environment.TickCount And Int32.MaxValue) - StartTime) >= Interval Then StartTime = Environment.TickCount And Int32.MaxValue ' set up next…
user79755
  • 2,623
  • 5
  • 30
  • 36
1
vote
1 answer

Is there any way to manipulate the value of the TimeGetTime timer

I have an app using the GetLastInputInfo function and compares it with the value of GetTickCount (which returns the number of milliseconds since Windows started) as a way of detecting nobody at the keyboard or mouse application for more than a…
rossmcm
  • 5,493
  • 10
  • 55
  • 118
1
vote
1 answer

How to set fixed FPS in Delphi using IdleHandler?

I have an OpenGL window within my Delphi application, which I want to render with fixed or uncapped FPS, depending on the choice of the user. Rendering the window every (e.g. 30 FPS) seems to work, what doesn't work is computing these FPS and…
Phil
  • 11
  • 2
1
vote
0 answers

Lag between GetTickCount() and timeGetTime() changes between executions of my test program

I know that GetTickCount() and timeGetTime() have different resolutions and that the timer resolution of timeGetTime() can be set via calls to timeBeginPeriod(). My understanding is that increasing the timer's resolution using timeBeginPeriod()…
d0d0
  • 160
  • 8
1
vote
1 answer

convert date format Www Mmm dd hh:mm:ss yyyy to dd hh:mm:ss string in c++

i want to convert date format "Www Mmm dd hh:mm:ss yyyy", and copy just "dd hh:mm:ss" to a string in c++. i have been tring so far it came like: char str[255]; char str1[255]; int y = 0; int i; time_t timer; timer = GetTickCount(); strcpy(str,…
1
2 3