/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <string.h>
static char *progname;
int debug = 0;
int lag;
static char zone_comment[] =
"#\n"
"# This file (%s) contains information used to manage the\n"
"# x86 real time clock hardware. The hardware is kept in\n"
"# the machine's local time for compatibility with other x86\n"
"# operating systems. This file is read by the kernel at\n"
"# command. The 'zone_info' field designates the local\n"
"# time zone. The 'zone_lag' field indicates the number\n"
"# of seconds between local time and Greenwich Mean Time.\n"
"#\n";
/*
* Open the configuration file and extract the
* zone_info and the zone_lag. Return 0 if successful.
*/
int
{
char b[256], *s;
int lag_hrs;
if (errors_ok == 0)
"%s: cannot open %s: errno = %d\n",
return (1);
}
for (;;) {
break;
continue;
s += 9;
while (*s != 0 && *s != '=')
s++;
if (*s == '=') {
s++;
while (*s != 0 && (*s == ' ' || *s == '\t'))
s++;
sizeof (zone_info));
s = zone_info;
while (*s != 0 && *s != '\n')
s++;
if (*s == '\n')
*s = 0;
}
s += 8;
while (*s != 0 && *s != '=')
s++;
if (*s == '=') {
s++;
while (*s != 0 && (*s == ' ' || *s == '\t'))
s++;
s = zone_lag;
while (*s != 0 && *s != '\n')
s++;
if (*s == '\n')
*s = 0;
}
}
}
if (zone_info[0] == 0) {
progname);
zone_info[0] = 0;
zone_lag[0] = 0;
return (1);
}
if (zone_lag[0] == 0) {
progname);
zone_lag[0] = 0;
return (1);
}
zone_info[0] = 0;
zone_lag[0] = 0;
return (1);
}
if (debug)
if (debug)
return (0);
}
void
display_zone_string(void)
{
if (open_zonefile() == 0)
else
(void) printf("GMT\n");
}
long
{
long current_lag;
(void) umask(0022);
return (0);
}
tz[3] = 0;
if (debug)
if (debug)
(void) system("env | grep TZ");
if (debug)
return (current_lag);
}
void
{
long kernels_lag;
long current_lag;
if (open_zonefile())
return;
tz[3] = 0;
if (debug)
if (debug)
(void) system("env | grep TZ");
if (debug)
}
if (current_lag != kernels_lag) {
if (debug)
/* new local time */
}
}
void
{
long current_lag;
/* write the config file */
/* correct the lag */
/*
* set the unix time from the rtc,
* assuming the rtc was the correct
* local time.
*/
}
void
usage()
{
rtc [-c] [-z time_zone] [-?]\n";
}
void
{
Options:\n\
-c\t\tCheck and correct for daylight savings time rollover.\n\
-z [zone]\tRecord the zone info in the config file.\n";
}
int
{
int c;
if (argc == 1) {
errors_ok = 1;
}
switch (c) {
case 'c':
continue;
case 'z':
continue;
case 'd':
debug = 1;
continue;
case '?':
return (0);
default:
usage();
return (1);
}
}
return (0);
}