aboutsummaryrefslogtreecommitdiff
path: root/util-linux/hwclock.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-14 02:23:43 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-14 02:23:43 +0000
commitea62077b850076c4d7dc3cf78ebd1888928c6ddf (patch)
tree37b7584ae40b99edb5583fbc4392b62ffdadf278 /util-linux/hwclock.c
parent88ca06769028e442bf873b270c176ca0e9f021f8 (diff)
downloadbusybox-w32-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.tar.gz
busybox-w32-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.tar.bz2
busybox-w32-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.zip
add open_read_close() and similar stuff
Diffstat (limited to 'util-linux/hwclock.c')
-rw-r--r--util-linux/hwclock.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index cce31335e..1aff87c11 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -51,11 +51,11 @@ static time_t read_rtc(int utc)
51 51
52 if (( rtc = open ( "/dev/rtc", O_RDONLY )) < 0 ) { 52 if (( rtc = open ( "/dev/rtc", O_RDONLY )) < 0 ) {
53 if (( rtc = open ( "/dev/misc/rtc", O_RDONLY )) < 0 ) 53 if (( rtc = open ( "/dev/misc/rtc", O_RDONLY )) < 0 )
54 bb_perror_msg_and_die ( "Could not access RTC" ); 54 bb_perror_msg_and_die ( "cannot access RTC" );
55 } 55 }
56 memset ( &tm, 0, sizeof( struct tm )); 56 memset ( &tm, 0, sizeof( struct tm ));
57 if ( ioctl ( rtc, RTC_RD_TIME, &tm ) < 0 ) 57 if ( ioctl ( rtc, RTC_RD_TIME, &tm ) < 0 )
58 bb_perror_msg_and_die ( "Could not read time from RTC" ); 58 bb_perror_msg_and_die ( "cannot read time from RTC" );
59 tm.tm_isdst = -1; /* not known */ 59 tm.tm_isdst = -1; /* not known */
60 60
61 close ( rtc ); 61 close ( rtc );
@@ -85,14 +85,14 @@ static void write_rtc(time_t t, int utc)
85 85
86 if (( rtc = open ( "/dev/rtc", O_WRONLY )) < 0 ) { 86 if (( rtc = open ( "/dev/rtc", O_WRONLY )) < 0 ) {
87 if (( rtc = open ( "/dev/misc/rtc", O_WRONLY )) < 0 ) 87 if (( rtc = open ( "/dev/misc/rtc", O_WRONLY )) < 0 )
88 bb_perror_msg_and_die ( "Could not access RTC" ); 88 bb_perror_msg_and_die ( "cannot access RTC" );
89 } 89 }
90 90
91 tm = *( utc ? gmtime ( &t ) : localtime ( &t )); 91 tm = *( utc ? gmtime ( &t ) : localtime ( &t ));
92 tm.tm_isdst = 0; 92 tm.tm_isdst = 0;
93 93
94 if ( ioctl ( rtc, RTC_SET_TIME, &tm ) < 0 ) 94 if ( ioctl ( rtc, RTC_SET_TIME, &tm ) < 0 )
95 bb_perror_msg_and_die ( "Could not set the RTC time" ); 95 bb_perror_msg_and_die ( "cannot set the RTC time" );
96 96
97 close ( rtc ); 97 close ( rtc );
98} 98}