Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a unix_timestamp extern #122

Merged
merged 5 commits into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dmsrc/time.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#define rustg_time_microseconds(id) text2num(RUSTG_CALL(RUST_G, "time_microseconds")(id))
#define rustg_time_milliseconds(id) text2num(RUSTG_CALL(RUST_G, "time_milliseconds")(id))
#define rustg_time_reset(id) RUSTG_CALL(RUST_G, "time_reset")(id)

/proc/rustg_unix_timestamp()
return text2num(RUSTG_CALL(RUST_G, "unix_timestamp")())
4 changes: 4 additions & 0 deletions src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ byond_fn!(fn time_reset(instant_id) {
Some("")
})
});

byond_fn!(fn unix_timestamp() {
Some(std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs().to_string())
ZephyrTFA marked this conversation as resolved.
Show resolved Hide resolved
});