Skip to content

Commit

Permalink
sys/ztimer: Remove the deprecated ztimer_now64
Browse files Browse the repository at this point in the history
This has been scheduled for removal after 2022.10, and its replacement
ztimer64_now has long been available.
  • Loading branch information
chrysn committed Aug 20, 2024
1 parent 6a9154c commit a263663
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 159 deletions.
1 change: 0 additions & 1 deletion makefiles/deprecated_modules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ DEPRECATED_MODULES += gnrc_nettype_gomach
DEPRECATED_MODULES += gnrc_nettype_lorawan
DEPRECATED_MODULES += gnrc_nettype_lwmac
DEPRECATED_MODULES += sema_deprecated
DEPRECATED_MODULES += ztimer_now64
26 changes: 5 additions & 21 deletions sys/include/ztimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,27 +301,13 @@ struct ztimer_base {
uint32_t offset; /**< offset from last timer in list */
};

/**
* @defgroup sys_ztimer_now64 ztimer_now64
* @brief 64-bit timestamp support
*
* @deprecated use @ref ztimer_now() returning uint32_t or alternatively use
* module `ztimer64` with @ref ztimer64_now() returning uint64_t.
* Will be removed after 2022.10 release.
*/
/**
* @typedef ztimer_now_t
* @brief type for ztimer_now() result
*
* @deprecated use @ref ztimer_now() returning uint32_t or alternatively use
* module `ztimer64` with @ref ztimer64_now() returning uint64_t.
* Will be removed after 2022.10 release.
* This is always uint32_t.
*/
#if MODULE_ZTIMER_NOW64
typedef uint64_t ztimer_now_t;
#else
typedef uint32_t ztimer_now_t;
#endif

/**
* @brief ztimer structure
Expand Down Expand Up @@ -393,7 +379,7 @@ struct ztimer_clock {
stopped state */
uint16_t users; /**< user count of this clock */
#endif
#if MODULE_ZTIMER_EXTEND || MODULE_ZTIMER_NOW64 || DOXYGEN
#if MODULE_ZTIMER_EXTEND || DOXYGEN
/* values used for checkpointed intervals and 32bit extension */
uint32_t max_value; /**< maximum relative timer value */
uint32_t lower_last; /**< timer value at last now() call */
Expand Down Expand Up @@ -570,7 +556,7 @@ void _ztimer_assert_clock_active(ztimer_clock_t *clock);
*
* There are several caveats to consider when using values returned by
* `ztimer_now()` (or comparing those values to results of @ref ztimer_set,
* which are compatible unless MODULE_ZTMIER_NOW64 is in use):
* which are compatible):
*
* * A single value has no meaning of its own. Meaningful results are only ever
* produced when subtracting values from each other (in the wrapping fashion
Expand Down Expand Up @@ -604,7 +590,7 @@ void _ztimer_assert_clock_active(ztimer_clock_t *clock);
*
* If the clock was active, then the difference between the second value and
* the first is then the elapsed time in the clock's unit, **modulo 2³²
* ticks** (or 2⁶⁴ when using the ZTIMER_NOW64 module).
* ticks**.
*
* * A difference between two values (calculated in the usual wrapping way) is
* guaranteed to be exactly the elapsed time (not just modulo 2³²) if there
Expand Down Expand Up @@ -683,9 +669,7 @@ static inline ztimer_now_t ztimer_now(ztimer_clock_t *clock)
_ztimer_assert_clock_active(clock);
#endif

#if MODULE_ZTIMER_NOW64
if (1) {
#elif MODULE_ZTIMER_EXTEND
#if MODULE_ZTIMER_EXTEND
if (clock->max_value < UINT32_MAX) {
#else
if (0) {
Expand Down
12 changes: 3 additions & 9 deletions sys/ztimer/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,7 @@ static void _ztimer_update(ztimer_clock_t *clock)
clock->ops->set(clock, clock->list.next->offset);
}
else {
if (IS_USED(MODULE_ZTIMER_NOW64)) {
/* ensure there's at least one ISR per half period */
clock->ops->set(clock, clock->max_value >> 1);
}
else {
clock->ops->cancel(clock);
}
clock->ops->cancel(clock);
}
}
}
Expand All @@ -445,8 +439,8 @@ void ztimer_handler(ztimer_clock_t *clock)
_ztimer_print(clock);
}

#if MODULE_ZTIMER_EXTEND || MODULE_ZTIMER_NOW64
if (IS_USED(MODULE_ZTIMER_NOW64) || clock->max_value < UINT32_MAX) {
#if MODULE_ZTIMER_EXTEND
if (clock->max_value < UINT32_MAX) {
/* calling now triggers checkpointing */
uint32_t now = ztimer_now(clock);

Expand Down
2 changes: 1 addition & 1 deletion sys/ztimer/xtimer2ztimer.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ identifier i;
@@

- xtimer_now_usec64()
+ ztimer_now64()
+ ztimer64_now()

@@
identifier i;
Expand Down
34 changes: 0 additions & 34 deletions tests/sys/xtimer_now64_continuity/Makefile

This file was deleted.

3 changes: 0 additions & 3 deletions tests/sys/xtimer_now64_continuity/Makefile.ci

This file was deleted.

6 changes: 0 additions & 6 deletions tests/sys/xtimer_now64_continuity/README.md

This file was deleted.

64 changes: 0 additions & 64 deletions tests/sys/xtimer_now64_continuity/main.c

This file was deleted.

20 changes: 0 additions & 20 deletions tests/sys/xtimer_now64_continuity/tests/01-run.py

This file was deleted.

0 comments on commit a263663

Please sign in to comment.