t090.py

00001 # This file is Copyright 2003, 2006, 2007, 2009 Dean Hall.
00002 #
00003 # This file is part of the Python-on-a-Chip program.
00004 # Python-on-a-Chip is free software: you can redistribute it and/or modify
00005 # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
00006 #
00007 # Python-on-a-Chip is distributed in the hope that it will be useful,
00008 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00010 # A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
00011 # is seen in the file COPYING up one directory from this.
00012 
00013 #
00014 # Test for Issue #90: Create new lib function to return system time
00015 # Ensure that time passes
00016 #
00017 
00018 import sys
00019 
00020 t0 = sys.time()
00021 
00022 print "t0 = ", t0
00023 
00024 print "killing time..."
00025 i=0
00026 while i < 10000:
00027     j=0
00028     while j < 100:
00029         j += 1
00030     if i%100 == 0:
00031         print i / 100, " ",
00032     i += 1
00033 print
00034 
00035 t1 = sys.time()
00036 
00037 if t1 <= t0:
00038     print "killing more time..."
00039     i=0
00040     while i < 10000:
00041         j=0
00042         while j < 1000:
00043             j += 1
00044         if i%100 == 0:
00045             print i / 100, " ",
00046         i += 1
00047     print
00048 
00049 t1 = sys.time()
00050 print "t1 = ", t1
00051 
00052 assert t1 > t0

Generated on Mon Oct 18 07:40:47 2010 for Python-on-a-chip by  doxygen 1.5.9