04 7 Amctimes
04 7 Amctimes
Jan Schaumann
jschauma@stevens.edu
https://stevens.netmeister.org/631/
CS631 - Advanced Programming in the UNIX Environment
struct stat
struct stat {
dev_t st_dev; /* device number (filesystem) */
ino_t st_ino; /* i-node number (serial number) */
mod_t st_mode; /* file type & mode (permissions) */
dev_t st_rdev; /* device number for special files */
nlink_t st_nlink; /* number of links */
uid_t st_uid; /* user ID of owner */
gid_t st_gid; /* group ID of owner */
off_t st_size; data
/* size in bytes, for regular files */
time_t st_atime; /* time of last Vaccess */
data
time_t st_mtime; /* time of lastVmodification */
time_t st_ctime; /* time of last file status change */
long st_blocks; /* number of 512-byte blocks allocated */
long st_blksize; /* optimal I/O block size */
}
3
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
atime
4
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
ctime
5
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
6
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
7
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
8
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
9
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
10
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
11
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
12
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
13
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
14
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
15
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
16
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
17
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
18
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
19
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
20
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
21
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
22
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
23
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
24
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
25
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
26
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
27
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
utimes(2)
#include <sys/time.h>
• if times is NULL, set atime and mtime to current time (write permissions sufficient)
• if times is non-NULL, set atime and mtime accordingly (need to be owner)
• either way, ctime is set to current time
• timespec allows for nanosecond precision
28
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
29
Jan Schaumann 2020-09-26
CS631 - Advanced Programming in the UNIX Environment
30
Jan Schaumann 2020-09-26