Comments (7)
用32位数据表示毫秒数, 应该足够40多天不会溢出. 你是在哪个ARCH下面遇到问题?
from ics-pa-gitbook.
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.
PAL调用的是SDL_GetTicks()
, 它已经要求从0开始了. 也因为这样, 当时NDL_GetTicks()
就故意设计成不必从0开始.
按道理即使NDL_GetTicks()
不要求从0开始, PAL应该也不会出现native有23天不正常的问题?
from ics-pa-gitbook.
讲义:
SDL_GetTicks(): 它和NDL_GetTicks()的功能完全一样
from ics-pa-gitbook.
这么说讲义至少有一处有错误吧(
from ics-pa-gitbook.
你说得对, 我们修改一下, 感谢指出!
from ics-pa-gitbook.
已修改讲义中SDL_GetTicks()
的描述
from ics-pa-gitbook.
Related Issues (20)
- 1.6 debug_hook 已经在 58f009646 被删除 HOT 1
- typo error from pa1 HOT 1
- installing llvm of pa0 HOT 1
- 关于讲义 3.2 节没有及时更新的一处路径 HOT 1
- PA3.3中的仙剑奇侠传配置文件文件能否提供一下 HOT 8
- 4.3 节 RISC-V 架构的 Difftest (Spike) 问题 HOT 6
- A small advice on PA2 basic infrastructure DiffTest part's snippet HOT 1
- 链接失效 HOT 1
- markdown error in why.html HOT 1
- PA1中FCEUX游戏ROM链接失效 HOT 1
- 关于内核栈和用户栈的分析描述 HOT 1
- 《PC的足迹》已无法阅读 HOT 2
- Install Ubuntu部分的补充 HOT 5
- [Suggestions] 在 am_native 中增加允许声卡多次打开的代码,并在 pa3、pa4 中完善声卡相关的提示 HOT 1
- ics2020 PA4.4 抢占多任务描述不完整 HOT 2
- html网页本地跳转有问题 HOT 4
- 关于包括Noop的完整ProjectN HOT 2
- Is there a plan to migrate to cmake? HOT 1
- 2.2 的 rz 描述不对 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ics-pa-gitbook.