stime(2)
๐ stime โ set time ๐
okay bestie, so this page is stime(2), straight out of the System Calls Manual, and it's literally the Unix syscall that sets the whole system's clock. it's giving legacy, and ngl we're gonna talk about why in a sec. โจ
๐ธ NAME ๐ธ
stime โ set time ๐ฐ๏ธ
๐ SYNOPSIS ๐
#include <time.h>
[[deprecated]] int stime(const time_t *t);
๐ฆ Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
stime():- Since glibc 2.19:
_DEFAULT_SOURCE
- glibc 2.19 and earlier:
_SVID_SOURCE
- Since glibc 2.19:
like, yes, you literally have to define a macro to even see this function, she's that hidden ๐
โจ DESCRIPTION โจ
NOTE: This function is deprecated; use clock_settime(2) instead.
okay so heads up: stime() is deprecated, bestie. the modern replacement is clock_settime(2) โ go hang out with her instead, she's the main character now ๐
stime() sets the system's idea of the time and date. like, the whole system's. every process, every file timestamp, the vibe of the entire machine. the time, pointed to by t, is measured in seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). so t is just a time_t * pointing at a raw epoch-seconds number. simple. iconic.
and the gatekeeping? immaculate. stime() may be executed only by the superuser. if you're not root, she does not know you. ๐
๐ RETURN VALUE ๐
- on success, zero is returned ๐ฅณ
- on error,
-1is returned, anderrnois set to indicate the error ๐ญ
๐ ERRORS ๐
EFAULTโ Error in getting information from user space. (basically you handed her a pointer she could not read from ๐)EPERMโ The calling process has insufficient privilege. Under Linux, theCAP_SYS_TIMEprivilege is required. (you tried to touch the clock without the clock-touching pass, bestie ๐)
โญ STANDARDS โญ
None.
and i oopโ she's not in any standard, she's just... there. ungoverned. free-spirited. ๐ง
๐ HISTORY ๐
- SVr4.
- Starting with glibc 2.31, this function is no longer available to newly linked applications and is no longer declared in
<time.h>.
so like, if you're compiling something new and you're trying to call her? she's not in the header anymore. she ghosted <time.h> fr fr ๐ the old binaries still work, but new links get nothing. it's giving retirement arc.
๐ซถ SEE ALSO ๐ซถ
lowkey real talk: if you're reaching forstime()in 2026, please considerclock_settime(2)instead. deprecated is deprecated, no cap. ๐ฅ
this has been your girl walking you through stime(2) from the Linux man-pages 6.20, dated 2026-02-08. stay clocked in, bestie ๐โจ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 1992, Drew Eckhardt <drew@cs.colorado.edu>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms