diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-21 19:38:05 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-21 19:39:05 +0900 |
| commit | 26bd490e6f9dc8476bc2cc9902f18692d8715df4 (patch) | |
| tree | 0c56c840527aa279fdcfda24a8aa79072ba0dec7 /crates/shirabe-php-shim/src | |
| parent | 1deb0b88edd455142160c0a03c094422907f2df6 (diff) | |
| download | php-shirabe-26bd490e6f9dc8476bc2cc9902f18692d8715df4.tar.gz php-shirabe-26bd490e6f9dc8476bc2cc9902f18692d8715df4.tar.zst php-shirabe-26bd490e6f9dc8476bc2cc9902f18692d8715df4.zip | |
feat(php-shim): implement microtime
Drop the get_as_float parameter; the Rust shim always returns f64.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-shim/src')
| -rw-r--r-- | crates/shirabe-php-shim/src/datetime.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/shirabe-php-shim/src/datetime.rs b/crates/shirabe-php-shim/src/datetime.rs index 79c5ea2..9810966 100644 --- a/crates/shirabe-php-shim/src/datetime.rs +++ b/crates/shirabe-php-shim/src/datetime.rs @@ -32,8 +32,11 @@ pub fn time() -> i64 { .as_secs() as i64 } -pub fn microtime(_get_as_float: bool) -> f64 { - todo!() +pub fn microtime() -> f64 { + let duration = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap(); + duration.as_secs_f64() } // PHP defaults to "UTC" when no default timezone has been configured. |
