
                            S r SSKrSSKrSSKrSSKrSSKrSSKrSr \R                  rg! \	 Ga)     \R                  S:X  a  \R                  " SSS9r " S S	\R                  5      r\R                  r\R                   \l        \" 5       r\R'                  \R(                  " \5      5        \R*                  \R,                  -  S
-  rS rGOO\R                  R1                  S5      (       d   \R                  R1                  S5      (       a  \R                  R1                  S5      (       a?   \R2                  R4                  rO=! \ a    \R2                  R9                  S5      r Of = f\R:                  R4                  r\" \SS5      r\(       a  \R@                  \l        S rGOs\RB                  r!\RD                  \!l        \RF                  " 5       r$Sq%Sq&S rGO< \R                  " \RN                  RQ                  S5      SS9RR                  r)O@! \* a7    \R                  " \RN                  RQ                  S5      SS9RR                  r) Of = f " S S\R                  5      r+\R                  R1                  S5      (       a  Sr,O\R                  R1                  S5      (       a  Sr,Oh\R                  R1                  S5      (       a  Sr,OES\R                  ;   a  Sr,O2\R                  R1                  S5      (       a  \RZ                  " S5      r,S r\" 5       \" 5       -
  S:  a  \." S 5      e g! \* a  r/\0" S!\1" \/5      -   5      eSr/C/ff = ff = f)"a  
monotonic
~~~~~~~~~

This module provides a ``monotonic()`` function which returns the
value (in fractional seconds) of a clock which never goes backwards.

On Python 3.3 or newer, ``monotonic`` will be an alias of
``time.monotonic`` from the standard library. On older versions,
it will fall back to an equivalent implementation:

+-------------+----------------------------------------+
| Linux, BSD  | ``clock_gettime(3)``                   |
+-------------+----------------------------------------+
| Windows     | ``GetTickCount`` or ``GetTickCount64`` |
+-------------+----------------------------------------+
| OS X        | ``mach_absolute_time``                 |
+-------------+----------------------------------------+

If no suitable implementation exists for the current platform,
attempting to import this module (or to import from it) will
cause a ``RuntimeError`` exception to be raised.


Copyright 2014, 2015, 2016 Ori Livneh <ori@wikimedia.org>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

    N)	monotonicdarwinz/usr/lib/libc.dylibT)	use_errnoc                   P    \ rS rSrSrS\R                  4S\R                  44rSrg)mach_timebase_info_data_t=   z4System timebase info. Defined in <mach/mach_time.h>.numerdenom N)	__name__
__module____qualname____firstlineno____doc__ctypesc_uint32_fields___static_attributes__r       2platform/gsutil/third_party/monotonic/monotonic.pyr   r   =   s$    J$foo6$foo68r   r       eAc                  $    [        5       [        -  $ )$Monotonic clock, cannot go backward.)mach_absolute_timeticks_per_secondr   r   r   r   r   I   s    )+.>>>r   win32cygwinzkernel32.dllGetTickCount64c                      [        5       S-  $ )r        @@)r   r   r   r   r   r   h   s    )+f44r   c                      [            [        5       n U [        :  a	  [        S-  qU q[        S-  nU[        -  nUS-  sSSS5        $ ! , (       d  f       g= f)r          r    N)get_tick_count_lockGetTickCountget_tick_count_last_sampleget_tick_count_wraparounds)current_samplefinal_millisecondss     r   r   r   u   sS    
 -)5),FF6!;65C2-G2-M**.HH*1F: -,,s   6A
Acrtc                   P    \ rS rSrSrS\R                  4S\R                  44rSrg)timespec   z5Time specification, as described in clock_gettime(3).tv_sectv_nsecr   N)	r   r   r   r   r   r   c_longr   r   r   r   r   r-   r-      s$    K%v}}5&68r   r-   linuxr"   freebsd   sunos5bsd   aix
   c                  
   [        5       n [        [        [        R                  " U 5      5      (       a5  [        R
                  " 5       n[        U[        R                  " U5      5      eU R                  U R                  S-  -   $ )r   r   )r-   clock_gettimeCLOCK_MONOTONICr   pointer	get_errnoOSErrorosstrerrorr/   r0   )tserrnos     r   r   r      s[    Z &..2DEE",,.E!%U);<<yy2::#555r   zmonotonic() is not monotonic!z,no suitable implementation for this system: )2r   r   ctypes.utilr@   sys	threadingtime__all__r   AttributeErrorplatformCDLLlibc	Structurer   r   c_uint64restypetimebasemach_timebase_infobyrefr	   r
   r   
startswithcdllkernel32r?   LoadLibrarywindllgetattrr   c_ulonglongr%   r   Lockr$   r&   r'   utilfind_libraryr;   	Exceptionr-   r<   
c_longlong
ValueErroreRuntimeErrorreprr   r   r   <module>rc      s  &N   	 
   uUI sUrU<<8# ;;4ED8F,<,< 8
 "&!8!8)/&02H##FLL$:;'~~>F? \\$$W--1H1H1R1R||&&x00G%{{33H G%{{66~FHG "==11$X/?FN)/););&5  (44'-$&/nn&6#-.*-.*; J &FKK,D,DS,I6:!<<IM  J &FKK,D,DT,J6:!<<IM J86++ 8
 ||&&w//"#((33"#((22"##,,&"#((//"("3"3B"76 ;$q(<== )  UIDQRGSTTUesUsq   + MC<L;0EL;!E+(L;*E++A7L;#4HL;:IL;IC$L;;MMMM