chiark / gitweb /
journal: correctly convert usec_t to timespec.
authorMichał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
Wed, 15 May 2013 09:28:58 +0000 (11:28 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 May 2013 01:02:46 +0000 (21:02 -0400)
Use timespec_store instead of (incorrectly) doing it inline.

src/journal/journald-server.c

index cc52b8a..b717b92 100644 (file)
@@ -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);
 
                 r = timerfd_settime(s->sync_timer_fd, 0, &sync_timer_enable, NULL);
                 if (r < 0)