瀏覽代碼

Add note about SDL_TICKS_PASSED hitting int overflow problems with large timeouts

Sam Lantinga 3 年之前
父節點
當前提交
227c33b8ec
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      include/SDL_timer.h

+ 4 - 0
include/SDL_timer.h

@@ -60,6 +60,10 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
  *     // ... do work until timeout has elapsed
  * }
  * ```
+ *
+ * Note that this does not handle tick differences greater
+ * than 2^31 so take care when using the above kind of code
+ * with large timeout delays (tens of days).
  */
 #define SDL_TICKS_PASSED(A, B)  ((Sint32)((B) - (A)) <= 0)