aq_i_6133...reloj del sistema
TRANSCRIPT
-
8/14/2019 AQ_I_6133...Reloj del sistema
1/10
-
8/14/2019 AQ_I_6133...Reloj del sistema
2/10
AQ_I_6133...Reloj del sistema.doc
Pag: 2
6ROXFLyQ
,QVWDODFLyQ GH XQ *36
Se puede instalar un sistema basado en GPS que permita sincronizar
peridicamente al ordenador. Esta solucin requiere de un GPS que tenga posibilidad demontaje exterior y que se conecte al ordenador por medio de puerto serie, ethernet oUSB.
Se requiere adems la instalacin de un programa servidor de tiempos que lea lahora del GPS y sincronice la hora del sistema.
-
8/14/2019 AQ_I_6133...Reloj del sistema
3/10
AQ_I_6133...Reloj del sistema.doc
Pag: 3
6LQFURQL]DFLyQ FRQ HO 57& GHO RUGHQDGRU
Esta opcin es mucho ms sencilla y barata de implementar.
La solucin consiste en instalar el programa ClockMon que permite leerperidicamente la hora del RTC y actualizar el reloj de Windows.
El programa puede descargarse gratuitamente de la siguiente direccin:http://www.softdevlabs.com/ClockMon/ClockMon.html
El fichero se descarga comprimido en un ZIP de 39 kB.La instalacin es muy sencilla y consiste en crear un directorio en el disco duro llamadoc:\clockmon Descomprimir el fichero Zip dentro del directorio recin creado.Ejecutar el programa clockmon.exe.Aparecer la siguiente pantalla:
Para acceder a la pantalla de configuracin hay que pulsar sobre File en el men ydespus Options
Se desplegar el siguiente cuadro de dialogo para configuracin:
-
8/14/2019 AQ_I_6133...Reloj del sistema
4/10
AQ_I_6133...Reloj del sistema.doc
Pag: 4
A continuacin se describe cmo se debe configurar las opciones:
,WHP 'HVFULSFLyQ 9DORUCheck the clock every Intervalo de tiempo entre
dos sincronizaciones15 minutos
Ensure accuracy is within Garantizar precisin majorque
100 ms
Only sample RTX time onseconds update boundary
Chequear solo en el cambiode segundos
Desactivado
Enable logging Grabacin de las accionesdel programa.Se puede activar
Desactivado.
Log all samplings Grabar informacin cadavez que se chequea el reloj
Desactivado
Create new log file eachtime
Crear un fichero coninformacin cada vez
Desactivado
Reset the clock when its
out-of-sync
Ajustar el reloj de Windows
cuando est desajustado
Activado
Allo backward syncs if needed
Permitir ajustes con tiemposnegativos.
Activado
Hide main window atstartup
Ocultar la ventana al inicio Activado
Finalmente slo queda aadir este programa ClockMon.exe en la carpeta de inicio deWindows para que se autoarranque cuando se arranque el sistema operativo.
-
8/14/2019 AQ_I_6133...Reloj del sistema
5/10
AQ_I_6133...Reloj del sistema.doc
Pag: 5
'RFXPHQWDFLyQ FRPSOHWD GHO SURJUDPD
Se incluye en este punto la documentacin completa disponible en Internet delprograma.
6RIWZDUH 'HYHORSPHQW /DERUDWRULHV
&ORFN0RQ
$ IUHH :LQGRZV UHDO WLPH FORFNPRQLWRULQJ DQG V\QFKURQL]DWLRQ XWLOLW\
9HUVLRQ
FOLFN RQ WKH DERYH OLQN WR GRZQORDG . (or build it y ourself from the source ; 128K)
7KH SUREOHP
I happened to notice that for some t ime now m y Windows system couldnt keeptime worth crap.It was constantly losing time, anywhere from several seconds per hour or so tomany m inutes per day ( sometimes as much as 15 m inutes or more in a single day!)I couldnt figure out why it was happening and just figured either my RTC circuitrywas bad or t he battery was low or somet hing.I even went so far as to install a little freeware clock synchronization program thatsyncs up your computer clock to one of the many atomic clock time servers outthere on the I nternet, and wr ote a little batch program to log the results.For several m onths I simply m ade note of t he fact that my clock was veryfrequently very out-of- sync with t he rest of t he world and made adjustments tohow often I would have to resync to one of the atomic clocks in order t o maintain areasonably accurate time-of-day clock, until eventually I had to resync every fewhours.Eventually, though, I began to not ice a definite patt ern.I noticed that whenever I w ould get heavily involved in program development,doing frequent compiles and links of whatever program I happen to be developing,the clock would get out of sync more quickly t han otherwise. I found this to beHVSHFLDOO\ true (especially noticeable) when I did cross-platform development underCygwin, using the GNU make and gcc compiler and other tools. I also noticed that
-
8/14/2019 AQ_I_6133...Reloj del sistema
6/10
AQ_I_6133...Reloj del sistema.doc
Pag: 6
during such Cygwin builds, my mouse would be slightly j erky and somewhat on t hesluggish side.This eventually caused me to suspect that the reason my clock was becoming moreand more out of sync was because clock interrupts were being lost, graduallycausing the Windows clock t o get furt her and furt her behind (i.e. to lose tim e).A few hours of investigation doing various searches on t he web and a few searchesof Microsofts own support database confirmed my suspicion.
However, as what may come to no surprise to some, the various suggested work-arounds failed to resolve the problem. My clock was still getting out of sync ratherquickly w henever I did some heavy dut y program development.
7KH VROXWLRQ
Eventually I decided enough was enough and sat down and wrote &ORFN0RQ , ahandy little program that periodically reads the hardware (BIOS or CMOS) RealTime Clock (RTC) and compares it with the Windows operating system clock,resetting the Windows clock whenever it notices the two are out of sync.
1RWH
&ORFN0RQ reads theReal Time Clock by doingdirect I / O to port 70,which is not normallyallowed under theWindows NT/2K/XPsecurity model.
But &ORFN0RQ isnonetheless DEOH WR UXQRQ :LQGRZV 17:LQGRZV DQG:LQGRZV ;3 V\VWHPVWRRthanks to a freedevice driver calledJLYHLR.
The tiny litt le JLYHLR device driver simply givesany program (thatproperly asks for it) thenecessary priv ileges to dodirect port I / O.
Just do a web search for"giveio" and you shouldfind several places whereyou can download it from .I t also comes with it s owncomplete set of source
-
8/14/2019 AQ_I_6133...Reloj del sistema
7/10
AQ_I_6133...Reloj del sistema.doc
Pag: 7
code just like &ORFN0RQ so you can build it foryourself if you want to.
&ORFN0RQ comes with aSUH EXLOW YHUVLRQ RI WKHJLYHLR device driver (aswell as t he source codetoo in case you want tobuild it for yourself) wh ichis DXWRPDWLFDOO\LQVWDOOHG WKH ILUVW WLPH\RX UXQ &ORFN0RQ ( ifyou dont already have itinstalled on your system ofcourse).
You see, the Windows operating system clock starts out with the same value as theReal Time Clock whenever you reboot your computer, but from then on, it isupdated completely independently of the RTC via periodic clock interrupts. Thus,over time (i.e. as the system runs), it is possible for the Windows operating systemclock to get out of sync with the actual hardware RTC clock (i.e. the actual "wallclock" tim e).This happens because as the system runs, cert ain softwar e and operating systemfunctions sometimes have to disable all interrupts causing the operating system tosometimes miss a clock interrupt. Most software that disable all interrupts(including the Windows operating system) dont keep interrupts disabled for verylong (its usually only for a VERY short period of time -- usually only a fewmicroseconds (millionths of a second) at most), but because they DO disable allinterrupts fr om t ime t o tim e, clock t icks ARE unfortunat ely periodically lost, and
over time, add up, causing the Windows operating system clock to sometimes differconsiderably fr om t he actual "wall clock" t ime ( sometim es by several minut es ormore, depending on system load and the variety and t ype of software pr ogramsrunning during the t ime period in question).When &ORFN0RQ notices the Windows operating system clock differs from theactual hardware Real Time Clock by more than a predefined amount (but less than30 minutes), it resets the minutes and seconds portion of the Windows systemclock to that of the RTC, thereby eliminating this annoying "Windows Clock Drift"problem and ensuring a m ore accurate Windows clock value ( since the BIOS/ CMOShardware RTC circuitry operates independently from the underlying operatingsystem and should under normal circumstances always be relatively accurate sinceit doesnt have to worr y about m issing an interrupt) .
8VLQJ &ORFN0RQ
Clicking the close box or the minimize box simply hides the main window so that itdoesnt clutter your screen or taskbar. To actually exit the program, you mustselect the "Exit" function from the "File" menu.Once hidden, you can easily cause the m ain window to be r edisplayed again bysimply double-clicking on its icon in the System Tray area. Right-clicking on the
-
8/14/2019 AQ_I_6133...Reloj del sistema
8/10
AQ_I_6133...Reloj del sistema.doc
Pag: 8
tray icon displays a context menu virtually identical to the menus that are availablefrom the main window.Also, if specified, an optional log file named "ClockMon.log" is created and writtento as the program runs which logs the current operating system tim e, the RTCtim e, and t he difference between the t wo. You have t he option of either loggingevery tim e sample the program makes, or only t he samples that cause the systemclock to actually be reset.
The log file entries look like this:11/06/02 18:54:36 RTC=54:37.000
SYS=54:36.994DIF=00:00.006
11/06/02 18:54:39 RTC=54:40.000SYS=54:39.989DIF=00:00.011 **
11/06/02 18:54:41 RTC=54:41.000SYS=54:41.001 !!DIF=00:00.001
An " ** " following the calculated difference between the two times indicates thesystem clock was reset for that log entry . I f the " ** " is not present, t hen thesystem clock was not reset for that sample. An " !! " ind icates that ClockMon
discovered an unusual occurrence: that the system clock was found to be ahead ofthe RTC tim e rather t han behind it as normally expected (i.e. t hat the Windowssystem clock appears to be running faster than the Real Time Clock rather thanslower as is normally expected). As far as I know, this is only an issue on WindowsNT/2K/XP systems and not on Win9x/Me systems.All ClockMon configurat ion sett ings can be entered v ia th e Options dialog orspecified via command-line arguments. Whatever values you specify (either via theOptions dialog or v ia command-line arguments) are saved and used t he next t imeClockMon ru ns:
ClockMon Command Line Arguments-----------------------------------
/hide show the main window initially hidden/nohide show the main window initially visible/log record the clock drift to the log file/nolog do NOT record the clock drift to the log file/logall record ALL time samplings to the log file
(ignored if /log not specified)/nologall only record samples causing the system clock tobe reset
(ignored if /log not specified)
/sync reset the Windows system clock when it's out-of-sync/nosync do NOT reset the Windows system clock; justmonitor it
/back do backward syncs too (ignored if /sync notspecified)
/noback only do forward syncs (ignored if /sync notspecified)/nn monitor and/or set clock every this many minutes
(where 'nn' is a number from 1 - 1440)
/nnnn reset system time whenever it differs from theRTC time
by more than this many milliseconds(where 'nn' is a number from 10 - 9999) Note: to specifthis value, you must specify the /nn sampling intervalfirst. The first number is always interpretted as the
-
8/14/2019 AQ_I_6133...Reloj del sistema
9/10
AQ_I_6133...Reloj del sistema.doc
Pag: 9
sampling interval and only the second subsequent number isinterpreted as the desired accuracy in milliseconds.
/sec0 force synchronization on RTC seconds updateboundary (see discussion further below for details)/nosec0 do NOT force seconds update boundarysynchronization
/clear clear the log file to empty before starting/noclear do NOT clear the log file to empty beforestarting filename use "filename" as the name of the log file (ifthe name contains blanks, surround it with double quotes)
The " sec0 " option forces ClockMon to retrieve the RTC time as close as possibleto when the Real Time Clock circuitry actually updates its 'seconds' register. Doingso ensures the RTC tim e value it uses to synchronize th e Windows system clockwit h is as accurate as possible (i. e. is as close to th e actual RTC tim e as possible).Not specifying th is option causes ClockMon to use whatever t ime v alue wasreturned by t he Real Time Clock at t he mom ent it read it, t hereby allowing it t o beoff by up to one second. (The Real Time Clock only returns hours, minutes andseconds (as well as the dat e of course, but ClockMon doesn't use it), but notmilliseconds. Thus, if the "actual" t ime was, for example, 14: 41: 53.997 w henever
ClockMon goes to read the RTC, the value that is returned to it (and the valuethat is uses to synchronize with) is only "14:41:53" (the Real Time Clock circuitrydoes not "r ound" the seconds value that it returns to you; it can only report whatsecond it actually is "right now"). If ClockMon were to then reset the Windowssystem clock to that value, the Windows system clock would then be off by 997mi lliseconds. Specifying " sec0 " how ever, causes ClockMon to w ait u nt il th e RealTime Clock reports that it is updating its seconds before reading the RTC timevalue, thus ensuring the RTC time it uses to synchronize the Windows system clockwith is as close as possible to the actual "true" time.
-
8/14/2019 AQ_I_6133...Reloj del sistema
10/10
AQ_I_6133...Reloj del sistema.doc
Pag: 10
:LWK WKH VHF RSWLRQ VSHFLILHG &ORFN0RQ LV DEOH WR DFKLHYH RQ DYHUDJHEHWWHU WKDQ PLOOL VHFRQG DFFXUDF\ 127( $IWHU VWDUWLQJ &ORFN0RQ IRU WKH ILUVW WLPH \RX PXVW PDQXDOO\ FRQILJXUH LWEHIRUH LW ZLOO EHJLQ UHV\QFLQJ \RXU :LQGRZV FORFN The default settings are to simply monitor t he clock but not to r eset (r esync) it. I fyou want ClockMon to sync your Windows clock, you m ust specifically WHOO i t to dothat. (The reason the default is specifically to QRW resync your clock is to prevent
unintended system modifications. Not everyone may want to use ClockMon toresync their clock. Some people may simply want t o m onitor t he inaccuracy of t heirWindows clock and n ot r esync it, so if y ou want ClockMon to actually r esync yourWindows clock, you need to specifically enable that option).
6XPPDU\
Since writing t his handy litt le program and adding it t o my Startup folder, myWindows clock is rarely ever out of sync by more than a few milliseconds or so, andI discovered that I don't even need t o resync to any of the I nternet at omic clocktime servers anymore since, apparently, my Real Time Clock (RTC) is quiteaccurate! (Or at least accurate enough for me; individual results may vary ofcourse.)So, if you're currently frustrated with having your Windows clock being constantlyout of sync, give &ORFN0RQ a try, and enjoy having an accurate and reliable clockagain. :)
")LVK" ( David B. Trout )f ish sof tdevlabs.com
3URJUDPPLQJ WRGD\ LV D UDFH EHWZHHQVRIWZDUH HQJLQHHUV VWULYLQJ WR EXLOG ELJJHU
DQG EHWWHU LGLRW SURRI SURJUDPV DQG WKH8QLYHUVH WU\LQJ WR SURGXFH ELJJHU DQG EHWWHULGLRWV 6R IDU WKH 8QLYHUVH LV ZLQQLQJ
5LFK &RRN
Report all web p age problems to: f ish sof tdev labs .com
!# "% $ & "( ') % ( &0 $ ! 12 34 1 ') 57 6 8@ 9( A B