Project

General

Profile

Bug #2586

fix timer duration calculations

Added by msuraev about 2 years ago. Updated 6 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
10/20/2017
Due date:
% Done:

100%

Spec Reference:

Description

The code in gprs_ns.c uses nsvc_timer_elapsed_ms() which relies on osmo_gettimeofday() wrapper around gettimeofday() which is affected by discontinuous jumps in the system time (e.g., if the system administrator manually changes the system time).

It's better to use monotonic clock via clock_gettime(CLOCK_MONOTONIC, ..) but this would requre replacing "struct timeval" with "struct timespec" for timer_started in "struct gprs_nsvc". I'm not aware of any external users for this field but nevertheless we should properly change API/ABI version when doing so.

On a related note: we should carefully check all the uses of osmo_gettimeofday() for elapsed time calculations and replace it with monotonic clock.


Related issues

Related to OsmoPCU - Bug #2407: N3101 not implemented in OsmoPCUClosed07/29/2017

Related to libosmocore - Feature #3309: osmo_timer_* should use monotonic clockNew05/30/2018

History

#1 Updated by laforge about 2 years ago

  • Assignee set to msuraev

#2 Updated by msuraev almost 2 years ago

In commit 1fa8dfbaf42a4341255b3bbef3c8a3c574e8c477 corresponding explanation have been added to osmo_gettimeofday().

#3 Updated by msuraev almost 2 years ago

  • Subject changed from fix NS timer calculations to fix timer duration calculations
  • Status changed from New to In Progress

The problem is more widespread than initially anticipated: BSSGP and osmo_timer_* also use non-monotonic osmo_gettimeofday() for duration calculations.

#4 Updated by msuraev almost 2 years ago

  • % Done changed from 0 to 10

#5 Updated by msuraev almost 2 years ago

  • Related to Bug #2407: N3101 not implemented in OsmoPCU added

#6 Updated by msuraev almost 2 years ago

  • % Done changed from 10 to 20

The groundwork is in gerrit 5103, fix for NS in 5104, fix for BSSGP in 5629, cleanup in 5631.
This bigger task of using monotonic clock for osmo_timer_*() still remains to be implemented.

#7 Updated by msuraev almost 2 years ago

  • Description updated (diff)

#8 Updated by msuraev almost 2 years ago

  • Status changed from In Progress to Stalled

#9 Updated by laforge over 1 year ago

  • Assignee deleted (msuraev)

#10 Updated by laforge over 1 year ago

  • Assignee set to stsp

#11 Updated by laforge 6 months ago

  • Related to Feature #3309: osmo_timer_* should use monotonic clock added

#12 Updated by laforge 6 months ago

  • Status changed from Stalled to Resolved
  • % Done changed from 20 to 100

the not-yet-implemented part of this issue is described in #3309

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)