zipios++
2.0.2
Zipios++ – a small C++ library that provides easy access to .zip files.
|
Functions to convert times between Unix and MS-DOS times. More...
Go to the source code of this file.
Functions | |
time_t | dos2unixtime (dostime_t dostime) |
Convert a DOS time to a Unix time. More... | |
dostime_t | dostime (int year, int month, int day, int hour, int minute, int second) |
dostime_t | maxdostime () |
Return the maximum possible value . More... | |
dostime_t | mindostime () |
Return the minimum possible value. More... | |
dostime_t | unix2dostime (time_t unix_time) |
Convert a Unix date to a DOS date. More... | |
These functions make use of the old date and time format defined to implement the FAT file system. This is defined on the Microsoft website here:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724247%28v=vs.85%29.aspx
As a quick recap, we have:
Date (actually we view those as bit 16 to 31)
Time
Definition in file dostime.c.
time_t dos2unixtime | ( | dostime_t | dostime | ) |
This function returns the Unix time_t value (GMT/UTC time) from the DOS format (local) time dostime, where dostime is a four byte value (date in most significant word, time in least significant word), see dostime() function.
If the input DOS time is invalid, then the function returns -1.
[in] | dostime | A DOS time value as found in a zip file. |
Definition at line 131 of file dostime.c.
Referenced by main(), zipios::ZipCentralDirectoryEntry::read(), zipios::ZipLocalEntry::read(), and zipios::FileEntry::setTime().
dostime_t dostime | ( | int | year, |
int | month, | ||
int | day, | ||
int | hour, | ||
int | minute, | ||
int | second | ||
) |
Definition at line 188 of file dostime.c.
Referenced by zipios::ZipCentralDirectoryEntry::read(), zipios::ZipLocalEntry::read(), unix2dostime(), zipios::ZipCentralDirectoryEntry::write(), and zipios::ZipLocalEntry::write().
dostime_t maxdostime | ( | ) |
This function returns the maximum DOS time that can be represented in a dostime_t parameter.
At this time we use a 32 bit field (like the Zip archive) so the maximum is Dec 31, 2107 23:59:59.
dostime_t mindostime | ( | ) |
This function returns the minimum DOS time that can be represented in a dostime_t parameter.
At this time we use a 32 bit field (like the Zip archive) so the maximum is Dec 31, 2107 23:59:59.
dostime_t unix2dostime | ( | time_t | unix_time | ) |
This function return the Unix time_t converted in DOS format, rounded up to the next even second.
[in] | unix_time | A Unix time_t value. |
Definition at line 219 of file dostime.c.
References dostime().
Referenced by zipios::FileEntry::getTime(), main(), zipios::ZipCentralDirectoryEntry::write(), and zipios::ZipLocalEntry::write().