System time¶
What is system time?¶
System time is a feature within the bframe library that allows for the internal clock to be set to the desired timestamp. To set system time the library configuration field system_datetime
must be updated. If the system_datetime
is not set, it will assume the current time.
The system_datetime
field controls what source data will be included when running transformations. If a pricebook was created today and the system time was set to yesterday, bframe would exclude this pricebook when running queries.
Why is system time important?¶
Modifying the system time can be useful for testing, debugging and auditing. For testing it’s common to create deterministic unit tests to ensure that expected behavior occurs. Having a system time can make time based testing easy, since the same timestamps can be used again and again.
Debugging and audits attempt to understand an outcome by retracing steps. Changing the system time is one way to get a picture of the state of the world before and after a change. When investigating a result, the system time can be moved forward or backward to understand exactly what happened. This makes system time a useful feature for whenever issues need to be tracked down.
How is system time used?¶
The system time can be set within the bframe configuration. Within the playground this can easily be set in the image below:
Once the field is populated all source data with a created_at
greater than the system time will be excluded.