File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -373,8 +373,14 @@ void clock_resynchronize(FAR struct timespec *rtc_diff)
373
373
374
374
/* Add the sleep time to correct system timer */
375
375
376
- g_system_ticks += SEC2TICK (rtc_diff -> tv_sec );
377
- g_system_ticks += NSEC2TICK (rtc_diff -> tv_nsec );
376
+ clock_t diff_ticks = SEC2TICK (rtc_diff -> tv_sec ) +
377
+ NSEC2TICK (rtc_diff -> tv_nsec );
378
+
379
+ #ifdef CONFIG_SYSTEM_TIME64
380
+ atomic64_fetch_add ((FAR atomic64_t * )& g_system_ticks , diff_ticks );
381
+ #else
382
+ atomic_fetch_add ((FAR atomic_t * )& g_system_ticks , diff_ticks );
383
+ #endif
378
384
}
379
385
380
386
skip :
@@ -398,6 +404,10 @@ void clock_timer(void)
398
404
{
399
405
/* Increment the per-tick system counter */
400
406
401
- g_system_ticks ++ ;
407
+ #ifdef CONFIG_SYSTEM_TIME64
408
+ atomic64_fetch_add ((FAR atomic64_t * )& g_system_ticks , 1 );
409
+ #else
410
+ atomic_fetch_add ((FAR atomic_t * )& g_system_ticks , 1 );
411
+ #endif
402
412
}
403
413
#endif
You can’t perform that action at this time.
0 commit comments