udftime.c (c58310bf4933986513020fa90b4190c7492995ae) udftime.c (cbf5676a0e0463f05e5073589f3194846dfb02e7)
1/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Paul Eggert (eggert@twinsun.com).
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.

--- 71 unchanged lines hidden (view full) ---

80/*2038*/ SPY(68, 17, 0)
81};
82
83extern struct timezone sys_tz;
84
85#define SECS_PER_HOUR (60 * 60)
86#define SECS_PER_DAY (SECS_PER_HOUR * 24)
87
1/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Paul Eggert (eggert@twinsun.com).
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.

--- 71 unchanged lines hidden (view full) ---

80/*2038*/ SPY(68, 17, 0)
81};
82
83extern struct timezone sys_tz;
84
85#define SECS_PER_HOUR (60 * 60)
86#define SECS_PER_DAY (SECS_PER_HOUR * 24)
87
88time_t *udf_stamp_to_time(time_t *dest, long *dest_usec, kernel_timestamp src)
88struct timespec *udf_stamp_to_time(struct timespec *dest, kernel_timestamp src)
89{
90 int yday;
91 uint8_t type = src.typeAndTimezone >> 12;
92 int16_t offset;
93
94 if (type == 1) {
95 offset = src.typeAndTimezone << 4;
96 /* sign extent offset */
97 offset = (offset >> 4);
98 if (offset == -2047) /* unspecified offset */
99 offset = 0;
89{
90 int yday;
91 uint8_t type = src.typeAndTimezone >> 12;
92 int16_t offset;
93
94 if (type == 1) {
95 offset = src.typeAndTimezone << 4;
96 /* sign extent offset */
97 offset = (offset >> 4);
98 if (offset == -2047) /* unspecified offset */
99 offset = 0;
100 } else {
100 } else
101 offset = 0;
101 offset = 0;
102 }
103
104 if ((src.year < EPOCH_YEAR) ||
105 (src.year >= EPOCH_YEAR + MAX_YEAR_SECONDS)) {
102
103 if ((src.year < EPOCH_YEAR) ||
104 (src.year >= EPOCH_YEAR + MAX_YEAR_SECONDS)) {
106 *dest = -1;
107 *dest_usec = -1;
108 return NULL;
109 }
105 return NULL;
106 }
110 *dest = year_seconds[src.year - EPOCH_YEAR];
111 *dest -= offset * 60;
107 dest->tv_sec = year_seconds[src.year - EPOCH_YEAR];
108 dest->tv_sec -= offset * 60;
112
113 yday = ((__mon_yday[__isleap(src.year)][src.month - 1]) + src.day - 1);
109
110 yday = ((__mon_yday[__isleap(src.year)][src.month - 1]) + src.day - 1);
114 *dest += (((yday * 24) + src.hour) * 60 + src.minute) * 60 + src.second;
115 *dest_usec = src.centiseconds * 10000 +
116 src.hundredsOfMicroseconds * 100 + src.microseconds;
111 dest->tv_sec += (((yday * 24) + src.hour) * 60 + src.minute) * 60 + src.second;
112 dest->tv_nsec = 1000 * (src.centiseconds * 10000 +
113 src.hundredsOfMicroseconds * 100 + src.microseconds);
117 return dest;
118}
119
120kernel_timestamp *udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts)
121{
122 long int days, rem, y;
123 const unsigned short int *ip;
124 int16_t offset;

--- 46 unchanged lines hidden ---
114 return dest;
115}
116
117kernel_timestamp *udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts)
118{
119 long int days, rem, y;
120 const unsigned short int *ip;
121 int16_t offset;

--- 46 unchanged lines hidden ---