rework histogram_bezier, init wm icon set_icon(gg), update de.po+msg/txt
[goodguy/history.git] / cinelerra-5.1 / guicast / condition.C
index 6bd8169e4a4a5e31be0b98b6973543bd293d4f7e..e57110cab9bb76a15299c195bceef055dca32d3e 100644 (file)
@@ -92,11 +92,11 @@ int Condition::timed_lock(int microseconds, const char *location)
        struct timeval now;
        gettimeofday(&now, 0);
 #if 1
-       struct timespec timeout;
-       timeout.tv_sec = now.tv_sec + microseconds / 1000000;
-       timeout.tv_nsec = now.tv_usec * 1000 + (microseconds % 1000000) * 1000;
-       while(value <= 0 && result != ETIMEDOUT)
-       {
+       int64_t nsec = now.tv_usec * 1000 + (microseconds % 1000000) * 1000;
+       int64_t sec = nsec / 1000000000;  nsec %= 1000000000;
+       sec += now.tv_sec + microseconds / 1000000;
+       struct timespec timeout;  timeout.tv_sec = sec;   timeout.tv_nsec = nsec;
+       while( value <= 0 && result != ETIMEDOUT ) {
                result = pthread_cond_timedwait(&cond, &mutex, &timeout);
        }