Page 107 -
P. 107

time is on our side






                             These are some of the functions provided by Python’s built-in time library:





                                 Python Library Documentation: time




                          time.clock()
                                 The current time in seconds, given as a floating

                                 point number.
                          time.daylight()
                                 This returns 0 if you are not currently in
                                 Daylight Savings Time.
                          time.gmtime()
                                 Tells you current UTC date and time (not affected

                                 by the timezone) .
                           time.localtime()
                                  Tells you the current local time (is affected by

                                  your timezone) .
                           time.sleep(secs)
                                  Don’t do anything for the specified number of

                                  seconds.
                                  Tells you the number of seconds since January 1st,
            This looks     time.time()

             like the best        1970.
             function to use.  time.timezone()
                                   your timezone and the UTC timezone (London).
                                   Tells you the number of hours difference between








                             You need to use one of these functions to help you fix your code.

                             But which one? You were to draw a circle around the function you thought you
                             might need.








           72    Chapter 2
   102   103   104   105   106   107   108   109   110   111   112