| Crates.io | faketime |
| lib.rs | faketime |
| version | 0.2.1 |
| created_at | 2018-12-20 15:59:56.501334+00 |
| updated_at | 2020-12-17 08:20:38.676524+00 |
| description | Fake time to ease testing and debugging |
| homepage | |
| repository | https://github.com/nervosnetwork/faketime |
| max_upload_size | |
| id | 102944 |
| size | 16,982 |
Provides a method unix_time which returns elapsed time since UNIX EPOCH.
The returned time can be faked in each thread separately.
Add faketime as dependency and use faketime::unix_time or
faketime::unix_time_as_millis to get current time.
To fake time in test:
faketime::millis_tempfile to create a temp timestamp file.faketime::enable in current thread.To fake time in child threads:
faketime::millis_tempfile to create a temp timestamp file.FAKETIME=PATH, where PATH is the path to the
timestamp file.To fake time of the generated binary, set the environment variable
echo 123456 > /tmp/faketime
FAKETIME=/tmp/faketime path/to/binary