Returns the Unix timestamp in seconds for a given time string
(
_state: &mut State<'gc>,
args: Vec<Value<'gc>>,
)
| 60 | |
| 61 | /// Returns the Unix timestamp in seconds for a given time string |
| 62 | fn time_unix_timestamp<'gc>( |
| 63 | _state: &mut State<'gc>, |
| 64 | args: Vec<Value<'gc>>, |
| 65 | ) -> Result<Value<'gc>, VmError> { |
| 66 | let time_str = string_arg!(&args, 0, "unix_timestamp")?; |
| 67 | |
| 68 | // Parse the datetime string (assumes ISO 8601 format) |
| 69 | let dt = DateTime::parse_from_rfc3339(time_str.to_str().unwrap()) |
| 70 | .map_err(|e| VmError::RuntimeError(format!("Failed to parse timestamp: {}", e)))?; |
| 71 | |
| 72 | Ok(Value::Number(dt.timestamp() as f64)) |
| 73 | } |
| 74 | |
| 75 | /// Sleeps for the specified number of seconds |
| 76 | fn time_sleep<'gc>(_state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> { |
nothing calls this directly
no test coverage detected