/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

  1. class EXAMPLE7
  2. --
  3. -- Using MICROSECOND_TIME to get more accuracy.
  4. --
  5. create {ANY}
  6. make
  7. feature {}
  8. make
  9. local
  10. mt1, mt2: MICROSECOND_TIME; string: STRING
  11. do
  12. io.put_string("Time to create a new small STRING:%N")
  13. mt1.update
  14. create string.make(12)
  15. mt2.update
  16. print_microsecond_time(mt1)
  17. print_microsecond_time(mt2)
  18. end
  19. print_microsecond_time (mt: MICROSECOND_TIME)
  20. do
  21. time_in_english.set_short_mode(True)
  22. time_in_english.set_time(mt.time)
  23. io.put_string(time_in_english.to_string + " " + mt.time.second.to_string + " seconds and " + mt.microsecond.to_string + " microseconds%N")
  24. end
  25. time_in_english: TIME_IN_ENGLISH
  26. once
  27. create Result
  28. end
  29. end -- class EXAMPLE7