Time zone is not set in settimeofday
salkind%nyu at sri-unix.UUCP
salkind%nyu at sri-unix.UUCP
Sun Mar 11 10:19:56 AEST 1984
From: Lou Salkind <salkind at nyu>
Subject: Time zone is not set in settimeofday
Index: sys/sys/kern_time.c 4.2BSD
Description:
The timezone field in the settimeofday system call is ignored.
(I discovered this when I tried to change the PST timezone on our
Pyramid system.)
Repeat-By:
Run the program below and you will see no difference.
Fix:
In kern_time.c:settimeofday(), just after the second
if (u.u_error)
return;
add
tz = atz;
Also, the following program will allow you to change the timezone:
----- timezone.c -----
/*
* timezone minuteswest [dsttime]
*/
#include <stdio.h>
#include <sys/time.h>
struct timeval tv;
struct timezone tz;
main(argc, argv)
int argc;
char *argv[];
{
if (argc < 2)
exit(0);
gettimeofday(&tv, &tz);
tz.tz_minuteswest = atoi(argv[1]);
if (argc > 2)
tz.tz_dsttime = atoi(argv[2]);
if (settimeofday(&tv, &tz) < 0) {
perror("settimeofday");
exit(1);
}
exit(0);
}
More information about the Comp.unix.wizards
mailing list