Skip to content

Commit 17822b5

Browse files
committed
feature #19606 [Clock] Introduce get/setMicroseconds() (alexandre-daubois)
This PR was merged into the 7.1 branch. Discussion ---------- [Clock] Introduce `get/setMicroseconds()` Fix #19587 Commits ------- 3dd28c0 [Clock] Introduce `get/setMicroseconds()`
2 parents c4bed9f + 3dd28c0 commit 17822b5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

components/clock.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,23 @@ The constructor also allows setting a timezone or custom referenced date::
235235
error handling across versions of PHP, thanks to polyfilling `PHP 8.3's behavior`_
236236
on the topic.
237237

238+
``DatePoint`` also allows to set and get the microsecond part of the date and time::
239+
240+
$datePoint = new DatePoint();
241+
$datePoint->setMicroseconds(345);
242+
$microseconds = $datePoint->getMicroseconds();
243+
244+
.. note::
245+
246+
This feature polyfills PHP 8.4's behavior on the topic, as microseconds manipulation
247+
is not available in previous versions of PHP.
248+
249+
.. versionadded:: 7.1
250+
251+
The :method:`Symfony\\Component\\Clock\\DatePoint::setMicroseconds` and
252+
:method:`Symfony\\Component\\Clock\\DatePoint::getMicroseconds` methods were
253+
introduced in Symfony 7.1.
254+
238255
.. _clock_writing-tests:
239256

240257
Writing Time-Sensitive Tests

0 commit comments

Comments
 (0)