|
acme
Foundational cross-platform layer of the ca2 framework
|
Functions to convert times between Unix and MS-DOS times. More...
#include "framework.h"#include "dostime1.h"#include <stdio.h>#include <stdlib.h>#include <string.h>Functions | |
| dos_time_t | minimum_dos_time () |
| Return the minimum possible value. | |
| dos_time_t | maximum_dos_time () |
| Return the maximum possible value . | |
| posix_time | dos_time_unix_time (dos_time_t dostime) |
| Convert a DOS time to a Unix time. | |
| dos_time_t | dos_time (::i32 year, ::i32 month, ::i32 day, ::i32 hour, ::i32 minute, ::i32 second) |
| dos_time_t | unix_time_dos_time (posix_time unix_time) |
| Convert a Unix date to a DOS date. | |
Functions to convert times between Unix and MS-DOS times.
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
| posix_time dos_time_unix_time | ( | dos_time_t | dostime | ) |
Convert a DOS time to a Unix time.
This function returns the Unix posix_time value (GMT/UTC time) from the DOS format (local) time dostime, where dostime is a four ::u8 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. |
\FIXME Maximum for tm_mday depends on month/year.
| dos_time_t maximum_dos_time | ( | ) |
Return the maximum possible value .
This function returns the maximum DOS time that can be represented in a dos_time_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.
| dos_time_t minimum_dos_time | ( | ) |
Return the minimum possible value.
This function returns the minimum DOS time that can be represented in a dos_time_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.
| dos_time_t unix_time_dos_time | ( | posix_time | unix_time | ) |
Convert a Unix date to a DOS date.
This function return the Unix posix_time converted in DOS format, rounded up to the next even second.
| [in] | unix_time | A Unix posix_time value. |