aboutsummaryrefslogtreecommitdiff
path: root/util-linux/hwclock.c
diff options
context:
space:
mode:
authormjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-03-19 09:13:01 +0000
committermjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-03-19 09:13:01 +0000
commite901c15d890dbbdce4c086963cb1513653fc46b5 (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /util-linux/hwclock.c
parent40758c00616c3b2c85d83eb4afdeb04b1f65c9f1 (diff)
downloadbusybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.tar.gz
busybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.tar.bz2
busybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.zip
Major coreutils update.
git-svn-id: svn://busybox.net/trunk/busybox@6751 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'util-linux/hwclock.c')
-rw-r--r--util-linux/hwclock.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 815b60b21..2eee3cfdb 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -77,11 +77,11 @@ time_t read_rtc ( int utc )
77 77
78 if (( rtc = open ( "/dev/rtc", O_RDONLY )) < 0 ) { 78 if (( rtc = open ( "/dev/rtc", O_RDONLY )) < 0 ) {
79 if (( rtc = open ( "/dev/misc/rtc", O_RDONLY )) < 0 ) 79 if (( rtc = open ( "/dev/misc/rtc", O_RDONLY )) < 0 )
80 perror_msg_and_die ( "Could not access RTC" ); 80 bb_perror_msg_and_die ( "Could not access RTC" );
81 } 81 }
82 memset ( &tm, 0, sizeof( struct tm )); 82 memset ( &tm, 0, sizeof( struct tm ));
83 if ( ioctl ( rtc, RTC_RD_TIME, &tm ) < 0 ) 83 if ( ioctl ( rtc, RTC_RD_TIME, &tm ) < 0 )
84 perror_msg_and_die ( "Could not read time from RTC" ); 84 bb_perror_msg_and_die ( "Could not read time from RTC" );
85 tm. tm_isdst = -1; // not known 85 tm. tm_isdst = -1; // not known
86 86
87 close ( rtc ); 87 close ( rtc );
@@ -111,7 +111,7 @@ void write_rtc ( time_t t, int utc )
111 111
112 if (( rtc = open ( "/dev/rtc", O_WRONLY )) < 0 ) { 112 if (( rtc = open ( "/dev/rtc", O_WRONLY )) < 0 ) {
113 if (( rtc = open ( "/dev/misc/rtc", O_WRONLY )) < 0 ) 113 if (( rtc = open ( "/dev/misc/rtc", O_WRONLY )) < 0 )
114 perror_msg_and_die ( "Could not access RTC" ); 114 bb_perror_msg_and_die ( "Could not access RTC" );
115 } 115 }
116 116
117 printf ( "1\n" ); 117 printf ( "1\n" );
@@ -122,7 +122,7 @@ void write_rtc ( time_t t, int utc )
122 printf ( "2\n") ; 122 printf ( "2\n") ;
123 123
124 if ( ioctl ( rtc, RTC_SET_TIME, &tm ) < 0 ) 124 if ( ioctl ( rtc, RTC_SET_TIME, &tm ) < 0 )
125 perror_msg_and_die ( "Could not set the RTC time" ); 125 bb_perror_msg_and_die ( "Could not set the RTC time" );
126 126
127 close ( rtc ); 127 close ( rtc );
128} 128}
@@ -138,7 +138,7 @@ int show_clock ( int utc )
138 138
139 safe_strncpy ( buffer, ctime ( &t ), sizeof( buffer )); 139 safe_strncpy ( buffer, ctime ( &t ), sizeof( buffer ));
140 if ( buffer [0] ) 140 if ( buffer [0] )
141 buffer [xstrlen ( buffer ) - 1] = 0; 141 buffer [bb_strlen ( buffer ) - 1] = 0;
142 142
143 //printf ( "%s %.6f seconds %s\n", buffer, 0.0, utc ? "" : ( ptm-> tm_isdst ? tzname [1] : tzname [0] )); 143 //printf ( "%s %.6f seconds %s\n", buffer, 0.0, utc ? "" : ( ptm-> tm_isdst ? tzname [1] : tzname [0] ));
144 printf ( "%s %.6f seconds\n", buffer, 0.0 ); 144 printf ( "%s %.6f seconds\n", buffer, 0.0 );
@@ -154,7 +154,7 @@ int to_sys_clock ( int utc )
154 tv. tv_sec = read_rtc ( utc ); 154 tv. tv_sec = read_rtc ( utc );
155 155
156 if ( settimeofday ( &tv, &tz )) 156 if ( settimeofday ( &tv, &tz ))
157 perror_msg_and_die ( "settimeofday() failed" ); 157 bb_perror_msg_and_die ( "settimeofday() failed" );
158 158
159 return 0; 159 return 0;
160} 160}
@@ -165,7 +165,7 @@ int from_sys_clock ( int utc )
165 struct timezone tz = { 0, 0 }; 165 struct timezone tz = { 0, 0 };
166 166
167 if ( gettimeofday ( &tv, &tz )) 167 if ( gettimeofday ( &tv, &tz ))
168 perror_msg_and_die ( "gettimeofday() failed" ); 168 bb_perror_msg_and_die ( "gettimeofday() failed" );
169 169
170 write_rtc ( tv. tv_sec, utc ); 170 write_rtc ( tv. tv_sec, utc );
171 return 0; 171 return 0;
@@ -181,7 +181,7 @@ int check_utc ( void )
181 char buffer [128]; 181 char buffer [128];
182 182
183 while ( fgets ( buffer, sizeof( buffer ), f )) { 183 while ( fgets ( buffer, sizeof( buffer ), f )) {
184 int len = xstrlen ( buffer ); 184 int len = bb_strlen ( buffer );
185 185
186 while ( len && isspace ( buffer [len - 1] )) 186 while ( len && isspace ( buffer [len - 1] ))
187 len--; 187 len--;
@@ -238,7 +238,7 @@ extern int hwclock_main ( int argc, char **argv )
238 utc_arg = 1; 238 utc_arg = 1;
239 break; 239 break;
240 default: 240 default:
241 show_usage(); 241 bb_show_usage();
242 break; 242 break;
243 } 243 }
244 } 244 }