TOUCH(3)

πŸ“¦ version 93vu, in opensuse-leap 16.0

πŸŽ€ touch(3) πŸŽ€

okay so this is the Library Functions Manual page for touch, and no cap, it's giving "set file access and modify times" with a lil side of chaos. let's get into it πŸ’–

✨ NAME ✨

touch β€” set file access and modify times

🌟 SYNOPSIS 🌟

#include <ast.h>

int touch(const char* path, time_t atime, time_t mtime, int force);

πŸ’« DESCRIPTION πŸ’«

touch sets the access and modify times of the file named by path. simple enough, bestie.

  • force != 0 β€” then the file is created if it doesn't exist. slay, new file energy πŸ”₯
  • otherwise β€” the file is not created, and -1 is returned. sad little return value 😭

and now the time behavior, because this is where it gets spicy:

  • force < 0 β€” atime and mtime are taken verbatim. like, exactly what you passed, no notes, periodt.
  • otherwise β€” (time_t)(-1) retains the current value for the file, and (time_t)(0) uses the current time. iconic sentinel behavior, fr fr ✨

⚠️ CAVEATS ⚠️

By default the change time is always changed to the current time. highkey important: even when you're just setting access/modify times, the change time gets updated to now. no cap 🫢


signing off from the Library Functions Manual β€” version/page TOUCH(3), no date shown on this lil footer, but the vibe is immaculate πŸ’…βœ¨

πŸ“¦ where this page comes from