aboutsummaryrefslogtreecommitdiff
path: root/util-linux/rdate.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/rdate.c')
-rw-r--r--util-linux/rdate.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 41aade5ea..bb1dc519a 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -95,9 +95,13 @@ int rdate_main(int argc UNUSED_PARAM, char **argv)
95 if (!(flags & 2)) { /* no -p (-s may be present) */ 95 if (!(flags & 2)) { /* no -p (-s may be present) */
96 if (time(NULL) == remote_time) 96 if (time(NULL) == remote_time)
97 bb_simple_error_msg("current time matches remote time"); 97 bb_simple_error_msg("current time matches remote time");
98 else 98 else {
99 if (stime(&remote_time) < 0) 99 struct timespec ts;
100 ts.tv_sec = remote_time;
101 ts.tv_nsec = 0;
102 if (clock_settime(CLOCK_REALTIME, &ts) < 0)
100 bb_simple_perror_msg_and_die("can't set time of day"); 103 bb_simple_perror_msg_and_die("can't set time of day");
104 }
101 } 105 }
102 106
103 if (flags != 1) /* not lone -s */ 107 if (flags != 1) /* not lone -s */