~ps10gel/ubuntu/xenial/trafficserver/6.2.0

« back to all changes in this revision

Viewing changes to lib/ts/ink_time.h

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2013-05-09 01:00:04 UTC
  • mto: (1.1.11) (5.3.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: package-import@ubuntu.com-20130509010004-9fqq9n0adseg3f8w
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
typedef time_t ink_time_t;
49
49
 
50
 
typedef int InkTimeDayID;
51
 
 
52
 
typedef struct
53
 
{
54
 
  InkTimeDayID base;
55
 
  unsigned int width;
56
 
} InkTimeDayRange;
57
 
 
58
50
/*===========================================================================*
59
51
 
60
52
                                 Prototypes
69
61
uint64_t ink_microseconds(int which);
70
62
double ink_time_wall_seconds();
71
63
 
72
 
int ink_time_gmt_string_to_tm(char *string, struct tm *bdt);
73
 
int ink_time_gmt_tm_to_rfc1123_string(struct tm *t, char *string, int maxsize);
74
 
 
75
 
InkTimeDayID ink_time_tm_to_dayid(struct tm *t);
76
 
void ink_time_dump_dayid(FILE * fp, InkTimeDayID dayid);
77
 
void ink_time_dayid_to_tm(InkTimeDayID dayid, struct tm *t);
78
 
InkTimeDayRange ink_time_dayid_to_dayrange(InkTimeDayID dayid, unsigned int width);
79
 
InkTimeDayRange ink_time_chomp_off_mouthful_of_dayrange(InkTimeDayRange * dayrange_ptr, unsigned int biggest_width);
80
 
char *ink_time_dayrange_to_string(InkTimeDayRange * dayrange_ptr, char *buf);
81
 
 
82
 
void ink_time_current_mdy(int *m, int *dom, int *y);
83
 
void ink_time_tm_to_mdy(struct tm *t, int *m, int *dom, int *y);
84
 
void ink_time_mdy_to_tm(int m, int dom, int y, struct tm *t);
85
 
InkTimeDayID ink_time_mdy_to_dayid(int m, int dom, int y);
86
 
InkTimeDayID ink_time_current_dayid();
87
 
void ink_time_dayid_to_mdy(InkTimeDayID dayid, int *mp, int *dp, int *yp);
88
 
int ink_time_mdy_to_doy(int m, int dom, int y);
89
 
void ink_time_doy_to_mdy(int doy, int year, int *mon, int *dom, int *dow);
90
 
int ink_time_mdy_to_dow(int month, int dom, int year);
91
 
int ink_time_days_in_month(int month, int year);
92
 
int ink_time_days_in_year(int year);
93
 
int ink_time_first_day_of_year(int year);
94
 
void ink_time_day_to_string(int day, char *buffer);
95
 
void ink_time_month_to_string(int month, char *buffer);
96
 
int ink_time_string_to_month(char *str);
97
 
int ink_time_leap_year_correction(int year);
98
 
 
99
 
/*===========================================================================*
100
 
 
101
 
                              Inline Stuffage
102
 
 
103
 
 *===========================================================================*/
104
 
 
105
 
static inline int
106
 
ink_time_is_4th_year(int year)
107
 
{
108
 
  return ((year % 4) == 0);
109
 
}                               /* End ink_time_is_4th_year */
110
 
 
111
 
 
112
 
static inline int
113
 
ink_time_is_100th_year(int year)
114
 
{
115
 
  return ((year % 100) == 0);
116
 
}                               /* End ink_time_is_100th_year */
117
 
 
118
 
 
119
 
static inline int
120
 
ink_time_is_400th_year(int year)
121
 
{
122
 
  return ((year % 400) == 0);
123
 
}                               /* End ink_time_is_400th_year */
124
 
 
125
64
int cftime_replacement(char *s, int maxsize, const char *format, const time_t * clock);
126
65
#define cftime(s, format, clock) cftime_replacement(s, 8192, format, clock)
127
66
 
128
 
inkcoreapi int ink_gmtime_r(const ink_time_t * clock, struct tm *res);
129
67
ink_time_t convert_tm(const struct tm *tp);
130
68
 
 
69
inkcoreapi char *ink_ctime_r(const ink_time_t * clock, char *buf);
 
70
inkcoreapi struct tm *ink_localtime_r(const ink_time_t * clock, struct tm *res);
 
71
 
 
72
/*===========================================================================*
 
73
                              Inline Stuffage
 
74
 *===========================================================================*/
131
75
#if defined(freebsd) || defined(openbsd)
132
76
 
133
77
inline int
139
83
  return tzp.tz_minuteswest * 60;
140
84
}
141
85
 
142
 
/* vl: not used
143
 
inline int ink_daylight() {
144
 
  struct tm atm;
145
 
  time_t t = time(NULL);
146
 
  ink_assert(!localtime_r(&t, &atm));
147
 
  return atm.tm_isdst;
148
 
}
149
 
*/
150
 
 
151
86
#else  // non-freebsd, non-openbsd for the else
152
87
 
153
88
inline int
156
91
  return timezone;
157
92
}
158
93
 
159
 
/* vl: not used - inline int ink_daylight() { return daylight; } */
160
 
#endif
161
 
 
162
 
inkcoreapi char *ink_ctime_r(const ink_time_t * clock, char *buf);
163
 
inkcoreapi struct tm *ink_localtime_r(const ink_time_t * clock, struct tm *res);
 
94
#endif /* #if defined(freebsd) || defined(openbsd) */
164
95
 
165
96
#endif /* #ifndef _ink_time_h_ */