chiark / gitweb /
Remove libidn checks/support
[elogind.git] / src / shared / clock-util.c
index 4f31c10b816ed0a60b5ff0c211f2a6b412eb7127..e4e03df1e47d196f1457e8c2ea00689de0780afb 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
-#include <string.h>
-#include <unistd.h>
 #include <errno.h>
 #include <errno.h>
-#include <stdlib.h>
-#include <signal.h>
 #include <stdio.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <sys/prctl.h>
 #include <sys/time.h>
 #include <linux/rtc.h>
 
 #include "macro.h"
 #include "util.h"
 #include <sys/time.h>
 #include <linux/rtc.h>
 
 #include "macro.h"
 #include "util.h"
-#include "log.h"
-#include "strv.h"
 #include "clock-util.h"
 #include "clock-util.h"
-#include "fileio.h"
 
 
-int clock_get_time(struct tm *tm) {
+int clock_get_hwclock(struct tm *tm) {
         _cleanup_close_ int fd = -1;
 
         assert(tm);
         _cleanup_close_ int fd = -1;
 
         assert(tm);
@@ -64,7 +51,7 @@ int clock_get_time(struct tm *tm) {
         return 0;
 }
 
         return 0;
 }
 
-int clock_set_time(const struct tm *tm) {
+int clock_set_hwclock(const struct tm *tm) {
         _cleanup_close_ int fd = -1;
 
         assert(tm);
         _cleanup_close_ int fd = -1;
 
         assert(tm);
@@ -121,12 +108,13 @@ int clock_set_timezone(int *min) {
         minutesdelta = tm->tm_gmtoff / 60;
 
         tz.tz_minuteswest = -minutesdelta;
         minutesdelta = tm->tm_gmtoff / 60;
 
         tz.tz_minuteswest = -minutesdelta;
-        tz.tz_dsttime = 0; /* DST_NONE*/
+        tz.tz_dsttime = 0; /* DST_NONE */
 
         /*
 
         /*
-         * If the hardware clock does not run in UTC, but in local time:
-         * The very first time we set the kernel's timezone, it will warp
-         * the clock so that it runs in UTC instead of local time.
+         * If the RTC does not run in UTC but in local time, the very first
+         * call to settimeofday() will set the kernel's timezone and will warp the
+         * system clock, so that it runs in UTC instead of the local time we
+         * have read from the RTC.
          */
         if (settimeofday(tv_null, &tz) < 0)
                 return -errno;
          */
         if (settimeofday(tv_null, &tz) < 0)
                 return -errno;
@@ -135,17 +123,17 @@ int clock_set_timezone(int *min) {
         return 0;
 }
 
         return 0;
 }
 
-int clock_reset_timezone(void) {
+int clock_reset_timewarp(void) {
         const struct timeval *tv_null = NULL;
         struct timezone tz;
 
         tz.tz_minuteswest = 0;
         const struct timeval *tv_null = NULL;
         struct timezone tz;
 
         tz.tz_minuteswest = 0;
-        tz.tz_dsttime = 0; /* DST_NONE*/
+        tz.tz_dsttime = 0; /* DST_NONE */
 
         /*
 
         /*
-         * The very first time we set the kernel's timezone, it will warp
-         * the clock. Do a dummy call here, so the time warping is sealed
-         * and we set only the timezone with the next call.
+         * The very first call to settimeofday() does time warp magic. Do a
+         * dummy call here, so the time warping is sealed and all later calls
+         * behave as expected.
          */
         if (settimeofday(tv_null, &tz) < 0)
                 return -errno;
          */
         if (settimeofday(tv_null, &tz) < 0)
                 return -errno;