Pergunta

The return type of SDL's time function SDL_GetTicks() is Uint32 which is a typedef uint32_t Uint32. The function gives the milliseconds after the start of the SDL application.

Now, 32 bits of unsigned integer holding milliseconds are roughly 50 days. Assuming I write an application (e.g. a game server that runs 24/7) that uses this function to calculate run speed, what will happen after 50 days of runtime when the 32 bit unsigned integer is full?

Foi útil?

Solução

It overflows.

According to this website and some other resources, the value will start over every 49.7 days.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top