diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-07-25 20:26:04 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-07-25 20:26:04 +0200 |
commit | 77e56d50bed29c1554d37e9d99ac81b7ef1ead6f (patch) | |
tree | c63cf9a96ded8843fd5e5b0a45b9caf958d68b8f /debian/patches/clock_boottime0001-include-provide-time-value-substraction.patch | |
parent | a611425f5f3643e3c3fa0a051ebc08f6cdcc5182 (diff) |
add patch series
Diffstat (limited to 'debian/patches/clock_boottime0001-include-provide-time-value-substraction.patch')
-rw-r--r-- | debian/patches/clock_boottime0001-include-provide-time-value-substraction.patch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/debian/patches/clock_boottime0001-include-provide-time-value-substraction.patch b/debian/patches/clock_boottime0001-include-provide-time-value-substraction.patch new file mode 100644 index 0000000..f65ae27 --- /dev/null +++ b/debian/patches/clock_boottime0001-include-provide-time-value-substraction.patch @@ -0,0 +1,70 @@ +From bb23879791cf015f17cb50b6443bac44b1cfbc72 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 25 Jul 2015 20:04:27 +0200 +Subject: [PATCH gnumach 1/2] include: provide time-value substraction + +* include/mach/time_value.h (time_value_assert): New macro to assert +that the given value is well-formed. +(time_value_add_usec): Use the new macro. +(time_value_sub_usec): New macro. +(time_value_add): Use `time_value_add_usec'. +(time_value_sub_usec): New macro. +--- + include/mach/time_value.h | 31 ++++++++++++++++++++++++------- + 1 file changed, 24 insertions(+), 7 deletions(-) + +diff --git a/include/mach/time_value.h b/include/mach/time_value.h +index 2a2f091..61be581 100644 +--- a/include/mach/time_value.h ++++ b/include/mach/time_value.h +@@ -45,23 +45,40 @@ typedef struct time_value time_value_t; + */ + #define TIME_MICROS_MAX (1000000) + ++#define time_value_assert(val) \ ++ assert(0 <= (val)->microseconds && (val)->microseconds < TIME_MICROS_MAX); ++ + #define time_value_add_usec(val, micros) { \ ++ time_value_assert(val); \ + if (((val)->microseconds += (micros)) \ + >= TIME_MICROS_MAX) { \ + (val)->microseconds -= TIME_MICROS_MAX; \ + (val)->seconds++; \ + } \ ++ time_value_assert(val); \ + } + +-#define time_value_add(result, addend) { \ +- (result)->microseconds += (addend)->microseconds; \ +- (result)->seconds += (addend)->seconds; \ +- if ((result)->microseconds >= TIME_MICROS_MAX) { \ +- (result)->microseconds -= TIME_MICROS_MAX; \ +- (result)->seconds++; \ +- } \ ++#define time_value_sub_usec(val, micros) { \ ++ time_value_assert(val); \ ++ if (((val)->microseconds -= (micros)) < 0) { \ ++ (val)->microseconds += TIME_MICROS_MAX; \ ++ (val)->seconds--; \ ++ } \ ++ time_value_assert(val); \ + } + ++#define time_value_add(result, addend) { \ ++ time_value_assert(addend); \ ++ (result)->seconds += (addend)->seconds; \ ++ time_value_add_usec(result, (addend)->microseconds); \ ++ } ++ ++#define time_value_sub(result, subtrahend) { \ ++ time_value_assert(subtrahend); \ ++ (result)->seconds -= (subtrahend)->seconds; \ ++ time_value_sub_usec(result, (subtrahend)->microseconds); \ ++ } ++ + /* + * Time value available through the mapped-time interface. + * Read this mapped value with +-- +2.1.4 + |