Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3040f735 authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Fix nano vs. millis"

parents d95dc28f a6260b83
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -53,7 +53,7 @@ public:
    ANDROID_API virtual void run() = 0;
    ANDROID_API virtual void run() = 0;


    RenderTask* mNext;
    RenderTask* mNext;
    nsecs_t mRunAt;
    nsecs_t mRunAt; // nano-seconds on the SYSTEM_TIME_MONOTONIC clock
};
};


class SignalingRenderTask : public RenderTask {
class SignalingRenderTask : public RenderTask {
+3 −2
Original line number Original line Diff line number Diff line
@@ -128,7 +128,8 @@ bool RenderThread::threadLoop() {
        if (nextWakeup == LLONG_MAX) {
        if (nextWakeup == LLONG_MAX) {
            timeoutMillis = -1;
            timeoutMillis = -1;
        } else {
        } else {
            timeoutMillis = nextWakeup - systemTime(SYSTEM_TIME_MONOTONIC);
            nsecs_t timeoutNanos = nextWakeup - systemTime(SYSTEM_TIME_MONOTONIC);
            timeoutMillis = nanoseconds_to_milliseconds(timeoutNanos);
            if (timeoutMillis < 0) {
            if (timeoutMillis < 0) {
                timeoutMillis = 0;
                timeoutMillis = 0;
            }
            }
@@ -149,7 +150,7 @@ void RenderThread::queue(RenderTask* task) {


void RenderThread::queueDelayed(RenderTask* task, int delayMs) {
void RenderThread::queueDelayed(RenderTask* task, int delayMs) {
    nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
    nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
    task->mRunAt = now + delayMs;
    task->mRunAt = now + milliseconds_to_nanoseconds(delayMs);
    queue(task);
    queue(task);
}
}