PageRenderTime 3ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/time/example7.e

http://github.com/tybor/Liberty
Specman e | 34 lines | 26 code | 5 blank | 3 comment | 0 complexity | f7e898d49d61cf36ef51d0d33e78c0f1 MD5 | raw file
 1class EXAMPLE7
 2   --
 3   -- Using MICROSECOND_TIME to get more accuracy.
 4   --
 5
 6create {ANY}
 7   make
 8
 9feature {}
10   make
11      local
12         mt1, mt2: MICROSECOND_TIME; string: STRING
13      do
14         io.put_string("Time to create a new small STRING:%N")
15         mt1.update
16         create string.make(12)
17         mt2.update
18         print_microsecond_time(mt1)
19         print_microsecond_time(mt2)
20      end
21
22   print_microsecond_time (mt: MICROSECOND_TIME)
23      do
24         time_in_english.set_short_mode(True)
25         time_in_english.set_time(mt.time)
26         io.put_string(time_in_english.to_string + " " + mt.time.second.to_string + " seconds and " + mt.microsecond.to_string + " microseconds%N")
27      end
28
29   time_in_english: TIME_IN_ENGLISH
30      once
31         create Result
32      end
33
34end -- class EXAMPLE7