Giter Site home page Giter Site logo

Comments (7)

sashimi-yzh avatar sashimi-yzh commented on August 14, 2024

用32位数据表示毫秒数, 应该足够40多天不会溢出. 你是在哪个ARCH下面遇到问题?

from ics-pa-gitbook.

top-mind avatar top-mind commented on August 14, 2024

native。
我的意思是用这种写法

uint32_t NDL_GetTicks() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return ((uint32_t)tv.tv_sec) * 1000 + tv.tv_usec / 1000;
}

在 native 下每 46 天有 23 天正常, 23 天不正常。因为PAL的time用的是带符号的,只要时间到负数就会有问题。
当然照手册规定的写前23天不会有问题。我想是说讲义最好明确这个函数的行为。

from ics-pa-gitbook.

sashimi-yzh avatar sashimi-yzh commented on August 14, 2024

PAL调用的是SDL_GetTicks(), 它已经要求从0开始了. 也因为这样, 当时NDL_GetTicks()就故意设计成不必从0开始.

按道理即使NDL_GetTicks()不要求从0开始, PAL应该也不会出现native有23天不正常的问题?

from ics-pa-gitbook.

top-mind avatar top-mind commented on August 14, 2024

讲义:

SDL_GetTicks(): 它和NDL_GetTicks()的功能完全一样

from ics-pa-gitbook.

top-mind avatar top-mind commented on August 14, 2024

这么说讲义至少有一处有错误吧(

from ics-pa-gitbook.

sashimi-yzh avatar sashimi-yzh commented on August 14, 2024

你说得对, 我们修改一下, 感谢指出!

from ics-pa-gitbook.

sashimi-yzh avatar sashimi-yzh commented on August 14, 2024

已修改讲义中SDL_GetTicks()的描述

from ics-pa-gitbook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.