/***
This file is part of systemd.
Copyright 2010-2012 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdbool.h>
#include <time.h>
#include <stdio.h>
#include "clock-util.h"
#include "fd-util.h"
#include "macro.h"
#include "string-util.h"
#include "util.h"
if (fd < 0)
return -errno;
/* This leaves the timezone fields of struct tm
* uninitialized! */
return -errno;
/* We don't know daylight saving, so we reset this in order not
* to confuse mktime(). */
return 0;
}
if (fd < 0)
return -errno;
return -errno;
return 0;
}
int clock_is_localtime(void) {
_cleanup_fclose_ FILE *f;
/*
* The third line of adjtime is "UTC" or "LOCAL" or nothing.
* 0.0 0 0
* 0
* UTC
*/
if (f) {
bool b;
if (!b)
return -EIO;
return -errno;
return 0;
}
int minutesdelta;
/*
* 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.
*/
return negative_errno();
if (min)
*min = minutesdelta;
return 0;
}
int clock_reset_timewarp(void) {
tz.tz_minuteswest = 0;
/*
* 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.
*/
return -errno;
return 0;
}
int clock_apply_epoch(void) {
return 0;
return -errno;
return 1;
}