. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 54.36.91.62 / Your IP :
216.73.216.168 [
Web Server : Apache System : Linux webm002.cluster127.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : eticmes ( 123698) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/eticmes/www/wp-content/plugins/the-events-calendar/common/src/functions/ |
Upload File : |
<?php
/**
* Time functions.
*
* @since 6.8.0
*/
/**
* Gets the current time in the format Y-m-d H:i:s.u rounded to 4 decimals.
* This function specifically has no dependencies any other code.
*
* @since 6.8.0
*
* @param DateInterval|null $add An interval to add to the current time.
* Defaults to null.
* @param DateInterval|null $sub An interval to subtract from the current time.
* Defaults to null.
* @param DateTimeZone|null $timezone The timezone to use. Defaults to null.
*
* @return string
*/
function tec_get_current_milliseconds( ?DateInterval $add = null, ?DateInterval $sub = null, ?DateTimeZone $timezone = null ): string {
$time = ( new DateTimeImmutable( 'now', $timezone ) );
if ( $add ) {
$time = $time->add( $add );
}
if ( $sub ) {
$time = $time->sub( $sub );
}
return $time->format( 'Y-m-d H:i:s' ) . '.' . str_pad( substr( microtime( true ), 11, 4 ), 4, '0', STR_PAD_RIGHT );
}
/**
* Given a tec_get_current_milliseconds() millisecond datetime, convert it to a timestamp.
*
* @since 6.8.0
*
* @param ?string $milliseconds The milliseconds to convert to a timestamp.
*
* @return ?int
*/
function tec_from_milliseconds_to_timestamp( ?string $milliseconds = null ): ?int {
if ( ! $milliseconds ) {
return null;
}
[$datetime,] = explode( '.', $milliseconds );
$time = DateTimeImmutable::createFromFormat( 'Y-m-d H:i:s', $datetime );
return $time->getTimestamp();
}