Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: samples/android_sample/jni/timer.cc

Issue 11434046: Android rayshader sample. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #include "timer.h"
2 #include "bin/log.h"
3
4 Timer::Timer() :
5 mElapsed(0.0f),
6 mLastTime(0.0) {
7 }
8
9 void Timer::reset() {
10 mElapsed = 0.0f;
11 mLastTime = now();
12 }
13
14 void Timer::update() {
15 double current = now();
16 mElapsed = (current - mLastTime);
17 mLastTime = current;
18 }
19
20 double Timer::now() {
21 timespec timeval;
22 clock_gettime(CLOCK_MONOTONIC, &timeval);
23 return timeval.tv_sec + (timeval.tv_nsec * 1.0e-9);
24 }
25
26 float Timer::elapsed() {
27 return mElapsed;
28 }
29
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698