You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## The difference between `timecop_freeze()` and `timecop_travel()`
70
+
71
+
`timecop_freeze()` is used to statically mock the concept of now. As your program executes, `time()` will not change unless you make subsequent calls into the Timecop API. `timecop_travel()`, on the other hand, computes an offset between what we currently think time() is and the time passed in. It uses this offset to simulate the passage of time. To demonstrate, consider the following code snippets:
72
+
73
+
```php
74
+
<?php
75
+
$new_time = mktime(12, 0, 0, 9, 1, 2008);
76
+
timecop_freeze($new_time);
77
+
sleep(10);
78
+
var_dump($new_time == time()); // bool(true)
79
+
80
+
timecop_return(); // "turn off" Timecop
81
+
82
+
timecop_travel($new_time);
83
+
sleep(10);
84
+
var_dump($new_time == time()); // bool(false)
85
+
```
86
+
67
87
## CHANGELOG
68
88
89
+
###version 1.0.5, 2013/11/26
90
+
- Fix `TimecopDateTime::createFromFormat()` to reutrn TimecopDateTime instance on PHP >= 5.3.4
91
+
- The previous version returns DateTime instance
92
+
- Implement identical function `timecop_date_create_from_format()`
93
+
- BUG: not supporting "relative formats" currently.
94
+
- Support 2nd argument of TimecopDateTime::_construct()
95
+
69
96
###version 1.0.4, 2013/03/11
70
-
-Fixed SIGSEGV in TimecopDateTime::__construct() called with NULL as 1st argument
97
+
-Fix SIGSEGV in TimecopDateTime::__construct() called with NULL as 1st argument
71
98
72
99
###version 1.0.3, 2013/03/09
73
100
74
-
-Fixed the time traveling implementation for TimecopDateTime::__construct()
75
-
-Fixed timecop_date_create() to return TimecopDateTime instance
101
+
-Fix the time traveling implementation for TimecopDateTime::__construct()
102
+
-Fix timecop_date_create() to return TimecopDateTime instance
76
103
- The previous version returns DateTime instance
77
104
- Add TimecopDateTime::getTimestamp(), TimecopDateTime::setTimestamp() only for PHP 5.2.x
0 commit comments