summaryrefslogtreecommitdiff
path: root/hwclock
diff options
context:
space:
mode:
authorLaMont Jones <lamont@debian.org>2009-10-19 07:58:11 -0600
committerLaMont Jones <lamont@debian.org>2009-10-19 07:58:11 -0600
commit7bfb9ff5418b4cf9d98efe04c109eef18b7b73e8 (patch)
tree5ce9985e4f9e438592dc73da82e430eeda68c83c /hwclock
parentde6990bd06560c70f13a43a6d7556af8a557c52c (diff)
parent5e51568e144746ab5821b43d9991c208189fbbb8 (diff)
downloadutil-linux-old-7bfb9ff5418b4cf9d98efe04c109eef18b7b73e8.tar.gz
Merge remote branch 'origin/master'
Conflicts: mount/lomount.c
Diffstat (limited to 'hwclock')
-rw-r--r--hwclock/clock.h4
-rw-r--r--hwclock/hwclock.c48
2 files changed, 27 insertions, 25 deletions
diff --git a/hwclock/clock.h b/hwclock/clock.h
index cbdf9991..e4eb7eba 100644
--- a/hwclock/clock.h
+++ b/hwclock/clock.h
@@ -7,6 +7,8 @@
#include <errno.h> /* for errno, EPERM, EINVAL, ENOENT */
#include <time.h>
+#include "c.h"
+
struct clock_ops {
char *interface_name;
int (*get_permissions)(void);
@@ -20,8 +22,6 @@ extern struct clock_ops *probe_for_rtc_clock(void);
extern struct clock_ops *probe_for_kd_clock(void);
typedef int bool;
-#define TRUE 1
-#define FALSE 0
/* hwclock.c */
extern char *progname;
diff --git a/hwclock/hwclock.c b/hwclock/hwclock.c
index 96fb3919..ac1f7c86 100644
--- a/hwclock/hwclock.c
+++ b/hwclock/hwclock.c
@@ -753,10 +753,10 @@ set_system_clock(const bool hclock_valid, const time_t newtime,
static int
-set_system_clock_timezone(const bool testing) {
+set_system_clock_timezone(const bool universal, const bool testing) {
/*----------------------------------------------------------------------------
Reset the System Clock from local time to UTC, based on its current
- value and the timezone.
+ value and the timezone unless universal is TRUE.
Also set the kernel time zone value to the value indicated by the
TZ environment variable and/or /usr/lib/zoneinfo/, interpreted as
@@ -791,7 +791,8 @@ set_system_clock_timezone(const bool testing) {
#endif
gettimeofday(&tv, NULL);
- tv.tv_sec += minuteswest * 60;
+ if (!universal)
+ tv.tv_sec += minuteswest * 60;
if (debug) {
struct tm broken_time;
@@ -1146,9 +1147,11 @@ manipulate_clock(const bool show, const bool adjust, const bool noadjfile,
int rc; /* local return code */
bool no_auth; /* User lacks necessary authorization to access the clock */
- no_auth = ur->get_permissions();
- if (no_auth)
- return EX_NOPERM;
+ if (!systz) {
+ no_auth = ur->get_permissions();
+ if (no_auth)
+ return EX_NOPERM;
+ }
if (!noadjfile && (adjust || set || systohc || (!utc && !local_opt))) {
rc = read_adjtime(&adjtime);
@@ -1229,14 +1232,10 @@ manipulate_clock(const bool show, const bool adjust, const bool noadjfile,
return rc;
}
} else if (systz) {
- if (!universal) {
- rc = set_system_clock_timezone(testing);
- if (rc) {
- printf(_("Unable to set system clock.\n"));
- return rc;
- }
- } else if (debug) {
- printf(_("Clock in UTC, not changed.\n"));
+ rc = set_system_clock_timezone(universal, testing);
+ if (rc) {
+ printf(_("Unable to set system clock.\n"));
+ return rc;
}
}
if (!noadjfile)
@@ -1654,16 +1653,19 @@ main(int argc, char **argv) {
if (debug)
out_version();
- determine_clock_access_method(directisa);
- if (!ur) {
- fprintf(stderr,
- _("Cannot access the Hardware Clock via "
- "any known method.\n"));
- if (!debug)
+ if (!systz) {
+ determine_clock_access_method(directisa);
+ if (!ur) {
fprintf(stderr,
- _("Use the --debug option to see the details "
- "of our search for an access method.\n"));
- hwclock_exit(1);
+ _("Cannot access the Hardware Clock via "
+ "any known method.\n"));
+ if (!debug)
+ fprintf(stderr,
+ _("Use the --debug option to see the "
+ "details of our search for an access "
+ "method.\n"));
+ hwclock_exit(1);
+ }
}
rc = manipulate_clock(show, adjust, noadjfile, set, set_time,