Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 708350
Collapse All | Expand All

(-)a/coreutils/date.c (-1 / +5 lines)
Lines 279-284 int date_main(int argc UNUSED_PARAM, char **argv) Link Here
279
		time(&ts.tv_sec);
279
		time(&ts.tv_sec);
280
#endif
280
#endif
281
	}
281
	}
282
#if !ENABLE_FEATURE_DATE_NANO
283
	ts.tv_nsec = 0;
284
#endif
282
	localtime_r(&ts.tv_sec, &tm_time);
285
	localtime_r(&ts.tv_sec, &tm_time);
283
286
284
	/* If date string is given, update tm_time, and maybe set date */
287
	/* If date string is given, update tm_time, and maybe set date */
Lines 301-309 int date_main(int argc UNUSED_PARAM, char **argv) Link Here
301
		if (date_str[0] != '@')
304
		if (date_str[0] != '@')
302
			tm_time.tm_isdst = -1;
305
			tm_time.tm_isdst = -1;
303
		ts.tv_sec = validate_tm_time(date_str, &tm_time);
306
		ts.tv_sec = validate_tm_time(date_str, &tm_time);
307
		ts.tv_nsec = 0;
304
308
305
		/* if setting time, set it */
309
		/* if setting time, set it */
306
		if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
310
		if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) {
307
			bb_perror_msg("can't set date");
311
			bb_perror_msg("can't set date");
308
		}
312
		}
309
	}
313
	}
(-)a/libbb/missing_syscalls.c (-8 lines)
Lines 15-28 pid_t getsid(pid_t pid) Link Here
15
	return syscall(__NR_getsid, pid);
15
	return syscall(__NR_getsid, pid);
16
}
16
}
17
17
18
int stime(const time_t *t)
19
{
20
	struct timeval tv;
21
	tv.tv_sec = *t;
22
	tv.tv_usec = 0;
23
	return settimeofday(&tv, NULL);
24
}
25
26
int sethostname(const char *name, size_t len)
18
int sethostname(const char *name, size_t len)
27
{
19
{
28
	return syscall(__NR_sethostname, name, len);
20
	return syscall(__NR_sethostname, name, len);
(-)a/util-linux/rdate.c (-2 / +6 lines)
Lines 95-103 int rdate_main(int argc UNUSED_PARAM, char **argv) Link Here
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_error_msg("current time matches remote time");
97
			bb_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_perror_msg_and_die("can't set time of day");
103
				bb_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 */

Return to bug 708350