Skip to content

Commit c98f567

Browse files
committed
Fix README
1 parent 61c2753 commit c98f567

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

README.md

+34-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## DESCRIPTION
66

7-
A PHP extension providing "time travel" and "time freezing" capabilities, inspired by [ruby timecop gem](http://github.com/jtrupiano/timecop).
7+
A PHP extension providing "time travel" and "time freezing" capabilities, inspired by [ruby timecop gem](https://github.com/travisjeffery/timecop).
88

99
## INSTALL
1010

@@ -27,7 +27,7 @@ extension=timecop.so
2727

2828
- OS: Linux, FreeBSD, MacOSX
2929
- PHP: 5.2.x, 5.3.x, 5.4.x, 5.5.x
30-
- Tested only on 5.2.17, 5.3.21, 5.4.11, and 5.5.0alpha4
30+
- Tested only on 5.2.17, 5.3.21, 5.4.11, and 5.5.5
3131
- SAPI: Apache, CLI
3232
- Other SAPIs are not tested, but there is no SAPI-dependent code.
3333
- non-ZTS(recommended), ZTS
@@ -49,8 +49,10 @@ extension=timecop.so
4949
- strftime()
5050
- gmstrftime()
5151
- unixtojd()
52-
- DateTime
52+
- DateTime::_construct()
53+
- DateTime::createFromFormat() (PHP >= 5.3.4)
5354
- date_create()
55+
- date_create_from_format() (PHP >= 5.3.4)
5456
- Rewrite value of the following global variables when the time has been moved.
5557
- $_SERVER['REQUEST_TIME']
5658

@@ -64,15 +66,40 @@ var_dump(gmdate("Y-m-d H:i:s")); // string(19) "1970-01-01 00:00:00"
6466
var_dump(strtotime("+100000 sec")); // int(100000)
6567
```
6668

69+
## 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+
6787
## CHANGELOG
6888

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+
6996
###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
7198

7299
###version 1.0.3, 2013/03/09
73100

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
76103
- The previous version returns DateTime instance
77104
- Add TimecopDateTime::getTimestamp(), TimecopDateTime::setTimestamp() only for PHP 5.2.x
78105

@@ -87,7 +114,7 @@ var_dump(strtotime("+100000 sec")); // int(100000)
87114

88115
###version 1.0.0, 2012/11/21
89116

90-
- Fixed memory leak
117+
- Fix memory leak
91118

92119
###version 0.0.1, 2012/06/19
93120

0 commit comments

Comments
 (0)