Current File : //usr/share/dstat/dstat_ntp.pyc |
�
��
Kc @ s2 d d l a d d l a d e f d � � YZ d S( i����Nt dstat_pluginc B s; e Z d Z d � Z d � Z d � Z d � Z d � Z RS( s
Time from an NTP server.
BEWARE: this dstat plugin typically takes a lot longer to run than
system plugins and for that reason it is important to use an NTP server
located nearby as well as make sure that it does not impact your other
counters too much.
c C s� d | _ d | _ d
| _ t j d � p- d | _ t j d � pE d | _ d | _ t t j
| j t j � � � | _ d | _
d
| _ t j t j t j � | _ | j j d � d S( Nt ntps date/timet timet
DSTAT_TIMEFMTs %d-%m %H:%M:%St DSTAT_NTPSERVERs 0.fedora.pool.ntp.orgt si l �~T g �?( s date/time( s time( t namet nickt varst ost getenvt timefmtt ntpservert typet lenR t strftimet localtimet widtht scalet epocht sockett AF_INETt
SOCK_DGRAMt
settimeout( t self( ( s /usr/share/dstat/dstat_ntp.pyt __init__ s $ c C sW | j j d d d | j d f � | j j d � \ } } t j d | � d | j S( Ns i/ t i{ i s !12Ii
( R t sendtoR t recvfromt structt unpackR ( R t datat address( ( s /usr/share/dstat/dstat_ntp.pyt gettime$ s $c C s\ y | j � WnG t j k
r4 t d | j � n$ t j k
rW t d | j � n Xd S( Ns# Failed to connect to NTP server %s.s"