aboutsummaryrefslogtreecommitdiff
path: root/core/sys/posix/utime.odin
blob: fca0dee59829ee720e6ee7b2de1e63d09ac16040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
package posix

when ODIN_OS == .Darwin {
	foreign import lib "system:System"
} else {
	foreign import lib "system:c"
}

// utime.h - access and modification time structure

foreign lib {
	/*
	Set file access and modification times.

	[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/utime.html ]]
	*/
	@(link_name=LUTIME)
	utime :: proc(path: cstring, times: ^utimbuf) -> result ---
}

when ODIN_OS == .NetBSD {
	@(private) LUTIME :: "__utime50"
} else {
	@(private) LUTIME :: "utime"
}

when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux || ODIN_OS == .Haiku {

	utimbuf :: struct {
		actime:  time_t, /* [PSX] access time (seconds since epoch) */
		modtime: time_t, /* [PSX] modification time (seconds since epoch) */
	}

}