@@ -38,13 +38,14 @@ Usage
38
38
-----
39
39
40
40
The :class: `Symfony\\ Component\\ Clock\\ Clock ` class returns the current time and
41
- allows to use any implementation of the interface described by `PSR-20 `_ as a global
42
- clock in your application::
41
+ allows to use any `PSR-20 `_ compatible implementation as a global clock in your
42
+ application::
43
43
44
44
use Symfony\Component\Clock\Clock;
45
45
use Symfony\Component\Clock\MockClock;
46
46
47
- // You can set a custom clock implementation, or use the NativeClock default one
47
+ // by default, Clock uses the NativeClock implementation, but you can change
48
+ // this by setting any other implementation
48
49
Clock::set(new MockClock());
49
50
50
51
// Then, you can get the clock instance
@@ -53,10 +54,10 @@ clock in your application::
53
54
// Additionally, you can set a timezone
54
55
$clock->withTimeZone('Europe/Paris');
55
56
56
- // From here, you are able to get the current time
57
+ // From here, you can get the current time
57
58
$now = $clock->now();
58
59
59
- // And also to sleep for an amount of time
60
+ // And sleep for any number of seconds
60
61
$clock->sleep(2.5);
61
62
62
63
The Clock component also provides the ``now() `` function::
@@ -66,11 +67,7 @@ The Clock component also provides the ``now()`` function::
66
67
// Get the current time as a DateTimeImmutable instance
67
68
$now = now();
68
69
69
- .. tip ::
70
-
71
- If you want to use the Clock component in your services, you may
72
- have a look at the section about
73
- :ref: `using a clock inside your services <clock_use-inside-a-service >`.
70
+ Later on this page you can learn how to use this clock in your services and tests.
74
71
75
72
.. versionadded :: 6.3
76
73
@@ -80,7 +77,7 @@ The Clock component also provides the ``now()`` function::
80
77
Available Clocks Implementations
81
78
--------------------------------
82
79
83
- The Clock component provides many ready-to-use implementations of the
80
+ The Clock component provides some ready-to-use implementations of the
84
81
:class: `Symfony\\ Component\\ Clock\\ ClockInterface `, which you can use
85
82
as global clocks in your application depending on your needs.
86
83
0 commit comments