fake_time.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Copyright (C) 2010 Internet Systems Consortium.
  2. #
  3. # Permission to use, copy, modify, and distribute this software for any
  4. # purpose with or without fee is hereby granted, provided that the above
  5. # copyright notice and this permission notice appear in all copies.
  6. #
  7. # THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM
  8. # DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
  9. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
  10. # INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
  11. # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
  12. # FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  13. # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  14. # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. __version__ = "$Revision$"
  16. # This is a dummy time class against a Python standard time class.
  17. # It is just testing use only.
  18. # Other methods which time class has is not implemented.
  19. # (This class isn't orderloaded for time class.)
  20. # These variables are constant. These are example.
  21. _TEST_TIME_SECS = 1283364938.229088
  22. _TEST_TIME_STRF = '2010-09-01T18:15:38Z'
  23. def time():
  24. """
  25. This is a dummy time() method against time.time()
  26. """
  27. # return float constant value
  28. return _TEST_TIME_SECS
  29. def gmtime():
  30. """
  31. This is a dummy gmtime() method against time.gmtime()
  32. """
  33. # always return nothing
  34. return None
  35. def strftime(*arg):
  36. """
  37. This is a dummy gmtime() method against time.gmtime()
  38. """
  39. return _TEST_TIME_STRF