System and Processes¶
Platform helpers for sleeping, timing, running shell commands, and making simple HTTP requests.
Sleep¶
| Function | Description |
|---|---|
void sleep_sec(double seconds) |
Block the calling thread for seconds. |
Time¶
| Function | Description |
|---|---|
var time_now(void) |
Wall-clock seconds since the Unix epoch as a float. |
Shell commands¶
| Function | Description |
|---|---|
var exec_cmd(const char *cmd) |
Run cmd through the platform shell; returns the exit status as an int. |
The command's stdout/stderr pass through to the process; the return value is the exit code.
HTTP GET¶
| Function | Description |
|---|---|
var http_get(const char *url) |
GET a URL over plain HTTP and return the response body as a string. |
Constraints:
- Plain HTTP only: the client always connects on port 80 (no https).
- Blocking and synchronous.
- Returns the body after the first \r\n\r\n; no redirect following.
Back to README.