summaryrefslogtreecommitdiffstats
path: root/hwclock
Commit message (Collapse)AuthorAgeFilesLines
* hwclock: add --predict for predicting RTC reading at a given timeTimo Juhani Lindfors2010-03-292-11/+37
| | | | | | | | | | Implement new option --predict that predicts what the RTC will read at a time given by the --date option. This is useful for example if you need to setup an RTC wakeup time to distant future and want to account for the RTC drift. Signed-off-by: Timo Juhani Lindfors <timo.lindfors@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: use c.hKarel Zak2009-10-161-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: set kernel timezone with --systz --utcScott James Remnant2009-10-131-11/+8Star
| | | | | | | | Even though --systz doesn't need to change the system clock when the hardware clock is in UTC time (--systz --utc), it does need to set the kernel timezone so that FAT timestamps, etc. will be correct. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
* hwclock: do not access hardware clock when using --systzScott James Remnant2009-10-131-12/+17
| | | | | | | | When using --systz we do not read from the hardware clock, so there is no need to search for a hardware clock. Indeed, we may be running hwclock --systz before /dev is mounted. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
* Remove now unused <sys/ioctl.h> includesGuillem Jover2009-10-091-1/+0Star
| | | | | | Those became unused with the switch to the blkdev functions. Signed-off-by: Guillem Jover <guillem@hadrons.org>
* replace usleep() for systems that don't have themDaniel Mierswa2009-08-211-0/+1
| | | | | | | | | This function is marked obsolete in POSIX.1-2001 and removed in POSIX.1-2008. Conditionally replaced with nanosleep(). Signed-off-by: Daniel Mierswa <impulze@impulze.org>
* hwclocks: use time limit for KDGHWCLK busy waitKarel Zak2009-08-201-19/+19
| | | | | | | | Currently the busy wait in synchronize_to_clock_tick_kd() is restricted by number of loops. It's better to use time limit (1.5s). We already use this method for RTC. Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock.8: formattingPeter Breitenlohner2009-08-171-23/+24
| | | | Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
* hwclock: fix mismatched popen/fclose.John Keeping2009-05-271-1/+1
| | | | | | | date_child_fp is opened by popen, so should be closed with pclose. Signed-off-by: John Keeping <john.keeping@lineone.net> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
* hwclock: add --systz option to set system clock from itselfScott James Remnant2009-03-102-8/+120
| | | | | | | | | | | | | | | Since the system clock time is already set from the hardware clock by the kernel (when compiled with CONFIG_RTC_HCTOSYS), there's no particular need to read the hardware clock again. This option sets the system clock using itself as a reference if the hardware clock was in local time. The resulting system clock time is in UTC, with the kernel timezone set to the difference. [kzak@redhat.com: - fix the condition that controls read_adjtime() call] Signed-off-by: Scott James Remnant <scott@ubuntu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: clock.h is included more than onceKarel Zak2008-11-261-4/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: remove "cli" and "sti" from i386 CMOS codeKarel Zak2008-10-161-25/+4Star
| | | | | | | | | | The protection against context switch is nonsense. There is possible to optimize the access to CMOS by mlockall(MCL_CURRENT) and SCHED_FIFO. For more details see: http://lkml.org/lkml/2008/10/12/132 Reported-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: several strings without gettext callsPedro Ribeiro2008-10-032-12/+12
| | | | | Signed-off-by: Pedro Ribeiro <p.m42.ribeiro@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: don't open /dev/rtc repeatedlyKarel Zak2008-08-181-22/+30
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: read_hardware_clock_rtc() need to return error codesKarel Zak2008-08-131-3/+3
| | | | | | We shouldn't ignore RTC_RD_TIME/RTCGET error codes. Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: delay loop in set_hardware_clock_exactKalev Soikonen2008-08-131-8/+12
| | | | | | | | | | | - Avoid delaying 1.5 seconds when 0.5 will do. - Guard for forward time resets as well. [kzak@redhat.com: - fix the "Delaying.." debug message - add comments] Signed-off-by: Kalev Soikonen <ksop@hot.ee> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: use time limit for synchronization busy waitKarel Zak2008-08-133-12/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: use carefully synchronize_to_clock_tick() return codesKarel Zak2008-08-131-3/+8
| | | | | | | | | | | | | | | | | * It seems that rtc-isl1208 0-006f: chip found, driver version 0.3 rtc-isl1208 0-006f: rtc core: registered rtc-isl1208 as rtc0 rtc-isl1208 0-006f: rtc power failure detected, please set clock. causes that hardware clock returns persistent time and synchronization is impossible. The hwclock(8) has to ignore this problem and allows to set clock anyway. * synchronize_to_clock_tick() shouldn't to print the "...got clock tick" debug message in case of failure. Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: remove x86_64-specific bogonDavid Brownell2008-08-121-1/+1
| | | | | | | | | | I was puzzled why "hwclock" wrongly reported my x86_64 sytem didn't support RTC update interrupts. Bogus #ifdef, that's why ... added by the 2.11y patch (from 2.11t). Probably this whole #ifdef should just vanish ... if the kernel rejects UIE_ON, the program ought to just cope with it. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* hwclock: cleanup help output and man pageKarel Zak2008-08-062-65/+42Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: unshadow a diagnostic printfKalev Soikonen2008-08-061-5/+3Star
| | | | | | | | | | - Bogus if test means one message is never produced. - Avoid needless passing of a global variable (debug). The --test option flag ought to be a global as well (and perhaps -n/--dry-run). Signed-off-by: Kalev Soikonen <ksop@hot.ee>
* hwclock: always reads hardware clockKarel Zak2008-06-172-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a pity that hwclock first tries to read the clock when running hwclock --systohc --noadjfile --utc and exits as this fails. I cannot see a reason to read first in that case. Old version: # hwclock --systohc --noadjfile --utc --debug hwclock from util-linux-ng 2.14 Using /dev interface to clock. Assuming hardware clock is kept in UTC time. Waiting for clock tick... /dev/rtc does not have interrupt functions. Waiting in loop for time from /dev/rtc to change ...got clock tick Time read from Hardware Clock: 2008/06/17 11:18:24 Hw clock time : 2008/06/17 11:18:24 = 1213701504 seconds since 1969 Time elapsed since reference time has been 0.904855 seconds. Delaying further to reach the next full second. Setting Hardware Clock to 11:18:24 = 1213701504 seconds since 1969 ioctl(RTC_SET_TIME) was successful. New version: # hwclock --systohc --noadjfile --utc --debug hwclock from util-linux-ng 2.14 Using /dev interface to clock. Assuming hardware clock is kept in UTC time. Time elapsed since reference time has been 0.572151 seconds. Delaying further to reach the next full second. Setting Hardware Clock to 11:18:52 = 1213701532 seconds since 1969 ioctl(RTC_SET_TIME) was successful. Addresses-Debian-Bug: #478663 Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: omit warning about drift if --noadjfile givenMatthias Koenig2008-06-161-4/+6
| | | | | | | | Currently, if hwclock is given the --noadjfile option it will nevertheless display information about the drift rate when invoked with the --debug option. Signed-off-by: Matthias Koenig <mkoenig@suse.de>
* build-sys: ignore a bunch of generated files, mostly binariesJames Youngman2008-04-141-0/+1
| | | | | Signed-off-by: James Youngman <jay@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: add --adjfile=path optionKarel Zak2008-04-092-29/+51
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use dist_man_MANS instead of man_MANSStepan Kasal2007-12-171-1/+1
| | | | Signed-off-by: Stepan Kasal <skasal@redhat.com>
* hwclock: check for ENODEVDavid Woodhouse2007-12-041-1/+1
| | | | | | | | | | | | | | /sbin/hwclock is supposed to fall back to using /dev/rtc0 if /dev/rtc isn't working (which it isn't, because mkinitrd creates it with the old device numbers, and we're switching to the new RTC_CLASS driver). Unfortunately, it'll only cope if the error it gets is ENOENT (i.e. the device node doesn't exist). It doesn't fall back to the next device in the list if the error is ENODEV, which is what happens when the device node exists, but there's no driver. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: do not create a zero adjfileAlain Guibert2007-10-261-0/+1
| | | | | | | | | | | | | When hwclock --hctosys is started very early during the system startup, with / still mounted read-only, and there was no /etc/adjtime file, hwclock fails creating a default adjfile full of zeroes, and prints an error message. I believe that such zero adjfile is not necessary, because it means exactly the same as no adjfile at all. The attached patch prevents creation of a zero adjfile, of course unless something gets changed (this never happens during a --hctosys). Signed-off-by: Alain Guibert <alguibert+ulng@free.fr>
* hwclock: fix --rtc optionMatthias Koenig2007-09-201-18/+15Star
| | | | | | | | | | | | | | | | | | | | | | The --rtc option does not set the name of the device correctly. It still uses /dev/rtc even if the --rtc option is given. Testcase: $ mv /dev/rtc /dev/foo $ hwclock --show --debug --rtc=/dev/foo hwclock from util-linux-2.13-rc2 Using /dev interface to clock. Last drift adjustment done at 1190198135 seconds after 1969 Last calibration done at 1190198135 seconds after 1969 Hardware clock is on local time Assuming hardware clock is kept in local time. Waiting for clock tick... hwclock: open() of /dev/rtc failed, errno=2: No such file or directory. ...got clock tick Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* remove hardcoded package name from some utilsKarel Zak2007-07-271-1/+1
| | | | | | | We have PACKAGE_STRING in config.h that includes package name and version. It's better to use this macro that hardcoded strings. Signed-off-by: Karel Zak <kzak@redhat.com>
* man pages: add "AVAILABILITY" sectionKarel Zak2007-07-031-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: do not use wildcards in EXTRA_DISTStepan Kasal2007-05-161-1/+1
| | | | | | | Wildcards in EXTRA_DIST break "make dist" for vpath build. But plain directory names are ok. Signed-off-by: Stepan Kasal <skasal@redhat.com>
* hwclock: make ggc happy and check return values from fgets, read and writeKarel Zak2007-03-212-13/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: remove tailing white-spaces and clean up clock.hKarel Zak2007-03-216-198/+207
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: add support for audit systemKarel Zak2007-03-215-15/+68
| | | | | | | | | If you compile --with-audit the hwclock tool reports changes in sys/hw clock to audit system. The real long-term and final solution is probably add hooks for /dev/rtc to kernel, but it's not implemented yet. Signed-off-by: Steve Grubb <sgrubb@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: fix --systohc sets clock 0.5 seconds slowKarel Zak2007-03-201-2/+7
| | | | | | | | | | | | | | | | quote from rh150493: The kernel code, when setting the BIOS clock notes that the clock time ticks to the next second 0.5 seconds after adjusting it (see linux/arch/i386/kernel/time.c). hwclock --systohc sets the CMOS clock at the 1 second boundry and thus causes the clock to be wrong by 500ms each time it is reset. If the clock is set every shutdown then the clock will have a reboot-count related drift as well as the natural drift problems of the clock. Note that this also mucks up the drift calculations, of course. Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: add --rtc=<path> option and support for /dev/rtc0Karel Zak2007-03-194-25/+73
| | | | | | | | | | | | The patch to allow "hwclock --rtc /dev/rtc1" and so on, since "/dev/rtc" may not be there and "/dev/rtc0" may not be the right answer either. The "--rtc" is compatible with next Bryan Henderson's hwclock versions. Signed-off-by: David Brownell <david-b@pacbell.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix README filenames and add missing files to EXTRA_DISTsKarel Zak2007-02-081-0/+1
| | | | | | Also, the patch makes "make mrproper" more robust. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add missing filesKarel Zak2007-01-041-1/+2
| | | | | | | This patch add all missing headers, man pages and README files to automake stuff and "make dist-gzip" produces useful tarball now. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: remove generated autotools stuff from gitKarel Zak2007-01-031-541/+0Star
| | | | | | | The generated autotools stuff shouldn't be maintained by SCM. After check out from git use ./autogen.sh. For more details see README.devel. Signed-off-by: Karel Zak <kzak@redhat.com>
* Imported from util-linux-2.13-pre6 tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.13-pre4 tarball.Karel Zak2006-12-071-0/+2
|
* Imported from util-linux-2.13-pre3 tarball.Karel Zak2006-12-071-2/+2
|
* Imported from util-linux-2.13-pre2 tarball.Karel Zak2006-12-071-81/+21Star
|
* Imported from util-linux-2.13-pre1 tarball.Karel Zak2006-12-077-46/+614
|
* Imported from util-linux-2.12l tarball.Karel Zak2006-12-076-4/+13
|
* Imported from util-linux-2.12i tarball.Karel Zak2006-12-072-4/+18
|
* Imported from util-linux-2.12a tarball.Karel Zak2006-12-071-4/+28
|
* Imported from util-linux-2.12 tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.11y tarball.Karel Zak2006-12-071-5/+4Star
|