Tryag File Manager
Home
-
Turbo Force
Current Path :
/
proc
/
self
/
root
/
usr
/
lib
/
python2.4
/
site-packages
/
mx
/
DateTime
/
Upload File :
New :
File
Dir
//proc/self/root/usr/lib/python2.4/site-packages/mx/DateTime/NIST.pyc
mò ›KX;c�������� ���@���s—��d��Z��d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�Z �y�e�i �d�d�ƒ�Z�Wn�e�i�j �o �d�Z�n�Xy�e�i �d�d�ƒ�Z �Wn�e�i�j �o �d�Z �n�Xd2�Z�h��d�d�<d �d�<d�d�<d�d�<d�d�<d�d�<d �d�<d �d�<d�d�<d�d�<Z�d3�Z�d�e�i�f�d�„��ƒ��YZ�d�Z�e�i�e�ƒ�Z�d �„��Z�e�i�e�i�e�i�e�i�e�e�i�e�i�e�e�i�d!�„ �Z�e�i�d"�„�Z�e�d#�e�i�e�e�i�e�i�e�i�d$�„�Z �d�a!�d%�a"�d&�a#�g��Z$�d'�Z%�d�e�i�e�i&�e�i'�e$�d(�„�Z'�e'�Z(�d�e�i)�e'�d)�„�Z)�e)�Z*�d*�„��Z+�d'�e�i'�e �e�i�d+�„�Z,�d,�„��Z-�d-�d.�„�Z.�e%�e$�d/�„�Z/�d0�„��Z0�e0�Z1�d1�„��Z2�d�S(4���sP�� Access routines to the NIST Network Time Services. This module allows you to access the UTC standard time bases via the Internet. The two functions localtime() and gmtime() will return accurate DateTime instances based on the NIST services. Since access through the Internet can be slow, the module also provides a way to calibrate the computer's clock and then have localtime() and gmtime() use the calibrated clock instead of the NIST services. To calibrate the two functions, call calibrate() with the number of calibration rounds you wish to apply. Copyright (c) 2000, Marc-Andre Lemburg; mailto:mal@lemburg.com Copyright (c) 2000-2001, eGenix.com Software GmbH; mailto:info@egenix.com See the documentation for further information on copyrights, or contact the author. All Rights Reserved. Ni����t���daytimet���tcpi ���t���timei%���s ���time.nist.govs���time-a.nist.govs���time-b.nist.govs���time-nw.nist.govs���time-a.timefreq.bldrdoc.govs���time-b.timefreq.bldrdoc.govs���time-c.timefreq.bldrdoc.govs���utcnist.colorado.edus���utcnist1.reston.mci.nets���nist1.datum.coms ���204.70.131.13s���129.6.16.35s���132.163.135.132s���132.163.135.130s ���209.0.72.7s���131.107.1.10s���132.163.135.131s���129.6.16.36s ���192.43.244.18s���128.138.140.44s&���http://time-a.timefreq.bldrdoc.gov:14/t���Errorc�����������B���s���t��Z�RS(���N(���t���__name__t ���__module__(����(����(����t4���/usr/lib/python2.4/site-packages/mx/DateTime/NIST.pyR���F���s���s·���(?P<mjd>\d+) (?P<date>\d+-\d\d-\d\d) (?P<hour>\d?\d):(?P<minute>\d\d):(?P<second>\d\d) (?P<dst>\d\d) (?P<leap>\d) (?P<health>\d) (?P<msadv>\d+(?:\.\d+)?) (?P<label>[\w()]+) (?P<otm>.)c���������C���s¾���t��i�|��ƒ�}�|�p�t�d�|��‚�n�|�i�ƒ��}�t�|�ƒ�}�xx�t�t �|�ƒ�ƒ�D]d�}�|�|�}�y�t�|�ƒ�|�|�<WqR�t�j �o1�y�t �|�ƒ�|�|�<Wq¶�t�j �o�q¶�XqR�XqR�W|�S(���sS�� Returns a sequence representing the parsed information in daytime. The sequence has the following format: [mjd,date,hour,minute,second,dst,leap,health,msadv,label,otm] Numbers are converted to numbers. Entries may be None. Raises a ValueError is the daytime information cannot be parsed. s���unkown daytime format: "%s"N(���t ���_daytimeREt���matchR����t���mt ���ValueErrort���groupst���listt���lt���ranget���lent���it���valuet���intt���float(���R����R���R���R ���R ���R���(����(����R���t���_parse_datetimeX���s"������ c���������C���s¦��|��}�| �i�|�ƒ�o�| �|�}��n5�y�|�|�ƒ�}��Wn�| �j �o�d�Sn�X|��| �|�<|�|�|�ƒ�}�|�i�d�ƒ�xy�|�i�|��|�f�ƒ�} �Wn-�| �j �o!�}�t�o �d�|�GHn�d�Sn�Xt�o�d�t�i�| �GHn�| �|�j�o›�|�g��|�g�g��|�ƒ�\�}�}�}�|�oY�|�i�d�ƒ�y�|�i�|��|�f�ƒ�} �Wq| �j �o �}�t�o �d�|�GHqw�qw�qXqƒt�o �d�GHn�d�} �n�Pqw�W| �d�j�o�d�Sn�|�Sd�S(���sñ��� Connect to the given host and port and return a socket instance. timeout states the number of seconds to wait for the connection to be established. In case no connection is possible, None is returned. i����i���s ��� error: %ss��� received %ss��� timeoutiÿÿÿÿN(���t���hostt���hostnamet���ip_cachet���has_keyt ���gethostbynamet���errort���Nonet���sockett���AF_INETt���SOCK_STREAMt���st���setblockingt ���connect_ext���DAYTIME_PORTt���rct���whyt���_debugt���errnot ���errorcodet���EINPROGRESSt���selectt���timeoutt���rt���wt���e(���R���t���portR*���R���R���R���R)���R"���R(���R���R���R���R���R#���R,���R$���R-���R���R+���(����(����R���t���_connectw���sL����� ��� � ! � � c���������C���sQ���|�|��g�g��g��|�ƒ�\�}�}�}�|�o�|��i�|�ƒ�Sn�t�o �d�GHn�d�Sd�S(���s¶��� Read size at most bytes from socket. timeout defines the amount of time to wait for data to become available. In case this time is exceeded, None is returned. s ��� read timeoutN( ���R)���R���R*���R+���R,���R-���t���recvt���sizeR%���R���(���R���R1���R*���R)���R-���R+���R,���(����(����R���t���_read³���s���� �!� i���c���������C���s2��t��o �d�GHn�xã�|��D]Ò�} �t��o �d�| �GHn�t�| �t�|�ƒ�}�|�oŸ�t�|�d�d�ƒ�}�|�d�j�o�q�n�|�|�ƒ�} �|�ƒ��}�|�i�ƒ��t��o �d�| �GHn�y�|�| �ƒ�} �Wn�t�j �o �q�n�X| �d�d�j�o�q�n�Pq�q�Wt�d�‚�|�| �d�ƒ�|�| �d �| �d �| �d�| �d�d �ƒ�|�f�S(���s�� Scans the given (NIST) daytime servers and returns a tuple: (DateTime instance representing the current UTC day time, ticks value of the time when the day time information was received) daytime_servers must be a list of servers providing the daytime protocol. They can be given by name or IP. timeout is used as timeout when connecting to each server. It must be given in seconds. The total timeout depends on the number of servers listed in daytime_servers. s���Contacting NIST servers...s���Trying server: %si���f0.5s��� read %si���i����s*���could not get accurate daytime informationi���i���i���i���f0.001N(���R%���t���daytime_serversR���R/���R"���R*���R���R2���t���dataR���t���stripR����R���t ���timestampt���closeR���R ���R���t���DateTimeFromMJDt���Time(���R3���R*���R5���R���R8���R9���R���R6���R���R����R���R4���(����(����R���t���_get_daytimeÄ���s4������ �� � i���f0.0i ���c��� ������C���sÌ���|��p�t�o�yy�t�|�ƒ�t�j�o�t�ƒ��n�t�ƒ��\�}�}�|�ƒ��}�|�|�i�}�|�ƒ��|�} �|�| �}�|�i�|�ƒ�|�|�| �ƒ�SWq»�t�j �o!�|��d�j�o �t�d�‚�q·�q»�Xn�|�|�ƒ��t�ƒ�S(���s©�� Returns the current UTC time as DateTime instance. Works must like the standard DateTime.now(), but tries to use the NIST time servers as time reference -- not only the computer's builtin clock. Note that the contructor may take several seconds to return in case no calibration was performed (see calibrate()). With calibration information, the computer's clock is used as reference and the offset to NIST time is compensated by the contructor. In case the NIST service is not reachable, the contructor falls back to using either the calibrated or uncalibrated computer's clock. Setting nist_lookup to false (default) will cause the contructor to prefer the calibrated CPU time over the expensive Internet queries. If it is true, then Internet lookups are always tried first before using the local clock. A value of 2 will cause an Error to be raised in case the NIST servers are not reachable. The constructor will use the NIST information for auto calibration, unless an explicit call to calibrate() takes care of this. i���s!���could not connect to NIST serversN(���t���nist_lookupt���calibratingR���t���_diffst ���_min_diffst���_update_calibrationR:���t���nistR6���t���utctimet���localt���secondst���diffR���t���adjt���appendt���DateTimeDeltaFromSecondsR���t���calibration( ���R;���R���RG���RA���R=���R6���R@���RD���RB���RE���(����(����R���RA���þ���s ����!� c���������C���s���|�|�|��ƒ�i�ƒ��ƒ�S(���sa��� Returns the current local time as DateTime instance. Same notes as for utctime(). N(���t ���localtimeRA���R;���t���gmticks(���R;���RI���RA���(����(����R���RI���3��s�����c�����������C���s-���y�t��ƒ��Wn�t�j �o�d�Sn�Xd�Sd�S(���sÉ��� Return 1/0 depending on whether the NIST service is currently reachable or not. This function is expensive since it actually fetches a daytime packet from a NIST server. i����i���N(���R:���R���(����(����(����R���t���onlineC��s����� c���������C���s‰���g��}�xQ�t�|��ƒ�D]C�}�|�ƒ��\�} �}�|�ƒ��} �| �| �i �|�ƒ��|�}�|�i�|�ƒ�q�Wd�}�x�|�D]�}�|�|�}�qg�W|�t�|�ƒ�S(���s�� Returns the average offset of the computer's clock to the NIST time base in seconds. If you add the return value to the return value of time.time(), you will have a pretty accurate time base to use in your applications. Note that due to network latencies and the socket overhead, the calculated offset will include a small hopefully constant error. iterations sets the number of queries done to the NIST time base. The average is taken over all queries. i����N(���t���diffsR���t ���iterationsR���R:���R@���R6���RA���RB���RC���R���RD���RF���t���sumR���(���RM���RA���R:���R���RL���R���R6���RN���RD���RB���R@���(����(����R���t���time_offsetS��s����� � �c���������C���s���|��a�d�a�d�a�d�S(���s��� Sets the calibration to be use by localtime() and utctime(). This also sets the global calibrated to 1 and disables auto calibration. i���i����N(���t���calibration_offsetRH���t ���calibratedR<���(���RP���(����(����R���t���set_calibrationr��s ������i���c���������C���s:���y�t��|��ƒ�}�Wn�t�t�f�j �o�n�Xt�|�ƒ�d�S(���s_�� Calibrates the localtime() and gmtime() functions supplied in this module (not the standard ones in DateTime !). Uses the NIST time service as time base. The computer must have an active internet connection to be able to do calibration using the NIST servers. iterations sets the number of round to be done. Note: This function takes a few seconds to complete. For long running processes you should recalibrate every now and then because the system clock tends to drift (usually more than the hardware clock in the computer). N(���RO���RM���RH���R ���R���RR���(���RM���RH���(����(����R���t ���calibrate��s�����c���������C���sQ���d�}�|�|��}�x�|�D]�}�|�|�}�q�W|�t�|�ƒ�a�g��|�(t�t�ƒ�d�S(���sŽ�� Updates the calibration from the last use_last entries in the global _diffs. _diffs is being updated with every call to the two current time APIs that goes out and gets genuine information from NIST. After calibration the entries in _diffs are cleared. This function is automatically called by utctime() and localtime() when needed. i����N(���RN���R=���t���use_lastRL���RD���R���RH���RR���(���RT���R=���RL���RN���RD���(����(����R���R?���—��s�������c�����������C���s���g��t��(d�a�d�S(���sm�� Enables and resets the auto calibration for a new round. This does not clear possibly available calibration information, so the two time APIs will continue to revert to the calibrated clock in case no connection to the NIST servers is possible. Auto calibration is on per default when the module is imported. i���N(���R=���R<���(����(����(����R���t���reset_auto_calibration°��s������c�����������C���s ���d�a��d�S(���s!��� Turns auto calibration off. i����N(���R<���(����(����(����R���t���disable_auto_calibrationÄ��s������( ���s ���time.nist.govs���time-a.nist.govs���time-b.nist.govs���time-nw.nist.govs���time-a.timefreq.bldrdoc.govs���time-b.timefreq.bldrdoc.govs���time-c.timefreq.bldrdoc.govs���utcnist.colorado.edus���utcnist1.reston.mci.nets���nist1.datum.com(���s&���http://time-a.timefreq.bldrdoc.gov:14/(3���t���__doc__R���R)���t���DateTimet���reR&���t ���exceptionst���stringR���R%���t ���getservbynameR"���R���t ���TIME_PORTR3���R���t���daytime_http_serverst ���StandardErrorR���t���_daytimet���compileR���R���R���R���R(���R���R/���R2���R5���R8���R9���R:���RQ���R<���RH���R=���R>���RG���RA���t���gmtimeRI���t���nowRK���RO���RR���RS���R?���RU���t���enable_auto_calibrationRV���(#���R3���R:���RX���RV���R`���RS���R)���Rc���R%���R&���RY���RA���RK���R>���RI���Rd���R[���R]���Rb���R���R"���R?���R���RR���R���R���RU���R/���R���R^���R2���R=���R���RZ���RO���(����(����R���t���?���sP��� - ` 9<*2!3