udf_times_to_stamp -> udf_timespec_to_stamp
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: udf_time.h,v 1.2 2005/10/27 11:18:56 rocky Exp $
|
$Id: udf_time.h,v 1.3 2005/10/30 14:10:44 rocky Exp $
|
||||||
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -33,44 +33,45 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the access time of the file.
|
Return the access time of the file.
|
||||||
*/
|
*/
|
||||||
time_t udf_get_access_time(const udf_file_t *p_udf_file);
|
time_t udf_get_access_time(const udf_file_t *p_udf_file);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the attribute (most recent create or access) time of the file
|
Return the attribute (most recent create or access) time of the file
|
||||||
*/
|
*/
|
||||||
time_t udf_get_attribute_time(const udf_file_t *p_udf_file);
|
time_t udf_get_attribute_time(const udf_file_t *p_udf_file);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the modification time of the file.
|
Return the modification time of the file.
|
||||||
*/
|
*/
|
||||||
time_t udf_get_modification_time(const udf_file_t *p_udf_file);
|
time_t udf_get_modification_time(const udf_file_t *p_udf_file);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the access timestamp of the file
|
Return the access timestamp of the file
|
||||||
*/
|
*/
|
||||||
udf_timestamp_t *udf_get_access_timestamp(const udf_file_t *p_udf_file);
|
udf_timestamp_t *udf_get_access_timestamp(const udf_file_t *p_udf_file);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the modification timestamp of the file
|
Return the modification timestamp of the file
|
||||||
*/
|
*/
|
||||||
udf_timestamp_t *udf_get_modification_timestamp(const udf_file_t *p_udf_file);
|
udf_timestamp_t *udf_get_modification_timestamp(const udf_file_t
|
||||||
|
*p_udf_file);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the attr timestamp of the file
|
Return the attr timestamp of the file
|
||||||
*/
|
*/
|
||||||
udf_timestamp_t *udf_get_attr_timestamp(const udf_file_t *p_udf_file);
|
udf_timestamp_t *udf_get_attr_timestamp(const udf_file_t *p_udf_file);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Convert a UDF timestamp to a time_t. If microseconds are desired,
|
Convert a UDF timestamp to a time_t. If microseconds are desired,
|
||||||
use dest_usec. The return value is the same as dest. */
|
use dest_usec. The return value is the same as dest. */
|
||||||
time_t *udf_stamp_to_time(time_t *dest, long int *dest_usec,
|
time_t *udf_stamp_to_time(time_t *dest, long int *dest_usec,
|
||||||
const udf_timestamp_t src);
|
const udf_timestamp_t src);
|
||||||
|
|
||||||
udf_timestamp_t *udf_time_to_stamp(udf_timestamp_t *dest,
|
udf_timestamp_t *udf_timespec_to_stamp(const struct timespec ts,
|
||||||
const struct timespec ts);
|
udf_timestamp_t *dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
blf 09/27/99: ripped out all the old code and inserted new table from
|
blf 09/27/99: ripped out all the old code and inserted new table from
|
||||||
John Brockmeyer (without leap second corrections)
|
John Brockmeyer (without leap second corrections)
|
||||||
rewrote udf_stamp_to_time and fixed timezone
|
rewrote udf_stamp_to_time and fixed timezone
|
||||||
accounting in udf_time_to_stamp.
|
accounting in udf_timespec_to_stamp.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -148,25 +148,29 @@ udf_stamp_to_time(time_t *dest, long int *dest_usec,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Convert a UDF timestamp to a time_t. If microseconds are desired,
|
||||||
|
use dest_usec. The return value is the same as dest. */
|
||||||
udf_timestamp_t *
|
udf_timestamp_t *
|
||||||
udf_time_to_stamp(udf_timestamp_t *dest, struct timespec ts)
|
udf_timespec_to_stamp(const struct timespec ts, udf_timestamp_t *dest)
|
||||||
{
|
{
|
||||||
long int days, rem, y;
|
long int days, rem, y;
|
||||||
const unsigned short int *ip;
|
const unsigned short int *ip;
|
||||||
int16_t offset;
|
int16_t offset;
|
||||||
|
int16_t tv_sec;
|
||||||
|
|
||||||
#ifdef HAVE_TIMEZONE_VAR
|
#ifdef HAVE_TIMEZONE_VAR
|
||||||
offset = -timezone;
|
offset = -timezone;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!dest)
|
if (!dest)
|
||||||
return NULL;
|
return dest;
|
||||||
|
|
||||||
dest->type_tz = 0x1000 | (offset & 0x0FFF);
|
dest->type_tz = 0x1000 | (offset & 0x0FFF);
|
||||||
|
|
||||||
ts.tv_sec += offset * SECS_PER_MINUTE;
|
tv_sec = ts.tv_sec + (offset * SECS_PER_MINUTE);
|
||||||
days = ts.tv_sec / SECS_PER_DAY;
|
days = tv_sec / SECS_PER_DAY;
|
||||||
rem = ts.tv_sec % SECS_PER_DAY;
|
rem = tv_sec % SECS_PER_DAY;
|
||||||
dest->hour = rem / SECS_PER_HOUR;
|
dest->hour = rem / SECS_PER_HOUR;
|
||||||
rem %= SECS_PER_HOUR;
|
rem %= SECS_PER_HOUR;
|
||||||
dest->minute = rem / SECS_PER_MINUTE;
|
dest->minute = rem / SECS_PER_MINUTE;
|
||||||
|
|||||||
Reference in New Issue
Block a user