- Click on System > Administration > Time & Date.
- Click on Unlock. Enter the password.
- Click on Time zone. Use the map or Selection to select your country.
- Click Close when your are done.
Showing posts with label time(). Show all posts
Showing posts with label time(). Show all posts
Monday, April 27, 2009
Set Ubuntu Time Zone
To set Ubuntu time zone,
Thursday, February 19, 2009
A simple way to time a small bits of Python code
A simple way to time a small bits of Python code is by using the time module. Please look at the example below.
In the above example, we want to measure how long will the function f() run.
>>> from time import time, sleep
>>> def f(x):
'''
Does nothing. Sleep for x seconds.
'''
sleep(x)
>>> time1 = time(); f(5); print('Run in {0:f} seconds.'
.format(time()-time1))
Run in 5.000000 seconds.
>>> def f(x):
'''
Does nothing. Sleep for x seconds.
'''
sleep(x)
>>> time1 = time(); f(5); print('Run in {0:f} seconds.'
.format(time()-time1))
Run in 5.000000 seconds.
Code break down:
In the above example, we want to measure how long will the function f() run.
- Import the time module.from time import time, sleep
- Get the current time.time1 = time()
- Run the function, get the current time, print the time elapsed.f(5)
print('Run in {0:f} seconds.'.format(time()-time1))
Subscribe to:
Posts
(
Atom
)