[systemd-devel] [PATCH] journal: correctly convert usec_t to timespec.

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed May 15 18:07:14 PDT 2013


On Wed, May 15, 2013 at 11:28:58AM +0200, Michał Bartoszkiewicz wrote:
> Use timespec_store instead of (incorrectly) doing it inline.
> ---
>  src/journal/journald-server.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
> index cc52b8a..b717b92 100644
> --- a/src/journal/journald-server.c
> +++ b/src/journal/journald-server.c
> @@ -1332,10 +1332,9 @@ int server_schedule_sync(Server *s) {
>                  return 0;
>  
>          if (s->sync_interval_usec) {
> -                struct itimerspec sync_timer_enable = {
> -                        .it_value.tv_sec = s->sync_interval_usec / USEC_PER_SEC,
> -                        .it_value.tv_nsec = s->sync_interval_usec % MSEC_PER_SEC,
> -                };
> +                struct itimerspec sync_timer_enable = {};
> +
> +                timespec_store(&sync_timer_enable.it_value, s->sync_interval_usec);
Thanks, applied.

Zbyszek


More information about the systemd-devel mailing list