diff options
Diffstat (limited to 'src/threading.c')
-rw-r--r-- | src/threading.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/threading.c b/src/threading.c index 68d1e41..00be243 100644 --- a/src/threading.c +++ b/src/threading.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * THREADING.C Copyright (c) 2007-08, Asko Kauppi | 2 | * THREADING.C Copyright (c) 2007-10, Asko Kauppi |
3 | * | 3 | * |
4 | * Lua Lanes OS threading specific code. | 4 | * Lua Lanes OS threading specific code. |
5 | * | 5 | * |
@@ -10,7 +10,7 @@ | |||
10 | /* | 10 | /* |
11 | =============================================================================== | 11 | =============================================================================== |
12 | 12 | ||
13 | Copyright (C) 2007-08 Asko Kauppi <akauppi@gmail.com> | 13 | Copyright (C) 2007-10 Asko Kauppi <akauppi@gmail.com> |
14 | 14 | ||
15 | Permission is hereby granted, free of charge, to any person obtaining a copy | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy |
16 | of this software and associated documentation files (the "Software"), to deal | 16 | of this software and associated documentation files (the "Software"), to deal |
@@ -178,6 +178,11 @@ static void prepare_timeout( struct timespec *ts, time_d abs_secs ) { | |||
178 | 178 | ||
179 | ts->tv_sec= floor( abs_secs ); | 179 | ts->tv_sec= floor( abs_secs ); |
180 | ts->tv_nsec= ((long)((abs_secs - ts->tv_sec) * 1000.0 +0.5)) * 1000000UL; // 1ms = 1000000ns | 180 | ts->tv_nsec= ((long)((abs_secs - ts->tv_sec) * 1000.0 +0.5)) * 1000000UL; // 1ms = 1000000ns |
181 | if (ts->tv_nsec == 1000000000UL) | ||
182 | { | ||
183 | ts->tv_nsec = 0; | ||
184 | ts->tv_sec = ts->tv_sec + 1; | ||
185 | } | ||
181 | } | 186 | } |
182 | #endif | 187 | #endif |
183 | 188 | ||