1ZIP_FILE_SET_MTIME(3)    BSD Library Functions Manual    ZIP_FILE_SET_MTIME(3)
2

NAME

4     zip_file_set_dostime, zip_file_set_mtime — set last modification time
5     (mtime) for file in zip
6

LIBRARY

8     libzip (-lzip)
9

SYNOPSIS

11     #include <zip.h>
12
13     int
14     zip_file_set_dostime(zip_t *archive, zip_uint64_t index,
15         zip_uint16_t dostime, zip_uint16_t dosdate, zip_flags_t flags);
16
17     int
18     zip_file_set_mtime(zip_t *archive, zip_uint64_t index, time_t mtime,
19         zip_flags_t flags);
20

DESCRIPTION

22     The zip_file_set_mtime() function sets the last modification time (mtime)
23     for the file at position index in the zip archive to mtime.  Currently,
24     no support for any flags is implemented.
25
26     In the zip archive, the time and date are saved as two 16-bit integers.
27     To set the values directly, call the zip_file_set_dostime() function.
28     The values of the time bytes are defined as follows:
29
30           0-4    day of the month (1-31)
31
32           5-8    month (January = 1, February = 2, ...)
33
34           9-15   year offset from 1980 (1980 = 0, 1981 = 1, ...)
35
36     The values of the date bytes are defined as follows:
37
38           0-4    seconds divided by two (1-2 = 1, 3-4 = 2, ...)
39
40           5-10   minute (0-59)
41
42           11-15  hour (0-23)
43

RETURN VALUES

45     Upon successful completion 0 is returned.  Otherwise, -1 is returned and
46     the error information in archive is set to indicate the error.
47

ERRORS

49     zip_file_set_dostime() and zip_file_set_mtime() fail if:
50
51     [ZIP_ER_INVAL]     index is not a valid file index in archive.
52
53     [ZIP_ER_MEMORY]    Required memory could not be allocated.
54
55     [ZIP_ER_RDONLY]    The archive was opened in read-only mode.
56

SEE ALSO

58     libzip(3), zip_stat(3)
59

HISTORY

61     zip_file_set_mtime() was added in libzip 1.0.  zip_file_set_dostime() was
62     added in libzip 1.6.
63

AUTHORS

65     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
66

CAVEATS

68     Following historical practice, the zip_file_set_mtime() function trans‐
69     lates the time from the zip archive into the local time zone.  If you
70     want to avoid this, use the zip_file_set_dostime() function instead.
71
72BSD                             January 7, 2020                            BSD
Impressum