tw.py 724 B

1234567891011121314151617181920
  1. import os
  2. from .tw_orig import *
  3. if os.getenv('MMGEN_TEST_SUITE_DETERMINISTIC'):
  4. def _time_gen():
  5. """ add a minute to each successive time value """
  6. for i in range(1000000):
  7. yield 1321009871 + (i*60)
  8. _time_iter = _time_gen()
  9. TwCommon.date_formatter = {
  10. 'days': lambda rpc,secs: (next(_time_iter) - secs) // 86400,
  11. 'date': lambda rpc,secs: '{}-{:02}-{:02}'.format(*time.gmtime(next(_time_iter))[:3])[2:],
  12. 'date_time': lambda rpc,secs: '{}-{:02}-{:02} {:02}:{:02}'.format(*time.gmtime(next(_time_iter))[:5]),
  13. }
  14. if os.getenv('MMGEN_BOGUS_WALLET_DATA'):
  15. # 1831006505 (09 Jan 2028) = projected time of block 1000000
  16. TwCommon.date_formatter['days'] = lambda rpc,secs: (1831006505 - secs) // 86400