[systemd-devel] [PATCH] avoid duplication of TIME_T_MAX

Lennart Poettering lennart at poettering.net
Mon Oct 20 15:40:16 PDT 2014


On Sat, 11.10.14 18:45, Ronny Chevalier (chevalier.ronny at gmail.com) wrote:

Applied! Thanks!

> ---
>  src/core/manager.c               | 3 +--
>  src/shared/time-util.h           | 2 ++
>  src/timesync/timesyncd-manager.c | 3 +--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/core/manager.c b/src/core/manager.c
> index e0c1cd1..dfd8cda 100644
> --- a/src/core/manager.c
> +++ b/src/core/manager.c
> @@ -75,6 +75,7 @@
>  #include "dbus-job.h"
>  #include "dbus-manager.h"
>  #include "bus-kernel.h"
> +#include "time-util.h"
>  
>  /* As soon as 5s passed since a unit was added to our GC queue, make sure to run a gc sweep */
>  #define GC_QUEUE_USEC_MAX (10*USEC_PER_SEC)
> @@ -84,8 +85,6 @@
>  #define JOBS_IN_PROGRESS_PERIOD_USEC (USEC_PER_SEC / 3)
>  #define JOBS_IN_PROGRESS_PERIOD_DIVISOR 3
>  
> -#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
> -
>  static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata);
>  static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata);
>  static int manager_dispatch_time_change_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata);
> diff --git a/src/shared/time-util.h b/src/shared/time-util.h
> index 05369d2..b55a660 100644
> --- a/src/shared/time-util.h
> +++ b/src/shared/time-util.h
> @@ -65,6 +65,8 @@ typedef struct dual_timestamp {
>  #define FORMAT_TIMESTAMP_RELATIVE_MAX 256
>  #define FORMAT_TIMESPAN_MAX 64
>  
> +#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
> +
>  #define DUAL_TIMESTAMP_NULL ((struct dual_timestamp) { 0, 0 })
>  
>  usec_t now(clockid_t clock);
> diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
> index 46f8bd6..e5b156b 100644
> --- a/src/timesync/timesyncd-manager.c
> +++ b/src/timesync/timesyncd-manager.c
> @@ -54,8 +54,7 @@
>  #include "mkdir.h"
>  #include "timesyncd-conf.h"
>  #include "timesyncd-manager.h"
> -
> -#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
> +#include "time-util.h"
>  
>  #ifndef ADJ_SETOFFSET
>  #define ADJ_SETOFFSET                   0x0100  /* add 'time' to current time */
> -- 
> 2.1.2
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list