39 #define DATE_BUFFER_SIZE (1024) 64 S32BIT m1 = (month - 14) / 12;
67 return 1461 * (y1 + m1) / 4 + 367 * (month - 2 - 12 * m1) / 12 - (3 * ((y1 + m1 + 100) / 100)) / 4 +
83 S32BIT p, q, r, s, t, u, v;
86 if ((day == 0) || (month == 0) || (year == 0))
88 DEBUG_PRINT((
"ERROR: CalendarDate invalid function parameters.\n"));
94 r = p - (146097 * q + 3) / 4;
95 s = 4000 * (r + 1) / 1461001;
96 t = r - 1461 * s / 4 + 31;
100 *year = 100 * (q - 49) + s + v;
101 *month = u + 2 - 12 * v;
102 *day = t - 2447 * u / 80;
126 DEBUG_PRINT((
"ERROR: MHEG5getDate unable to get current time. GetLocalTime returned %d\n", err));
148 S32BIT d, m, y, i = 0, h, min, s, h2;
152 CalendarDate(day, &d, &m, &y);
156 min = (sec - (h * 3600)) / 60;
157 s = sec - h * 3600 - min * 60;
167 while (i < format.
len)
170 if ((format.
data[i] ==
'%') && (i + 1 < format.
len))
172 switch (format.
data[i + 1])
175 sprintf(buf2,
"%04ld", (
long)y);
179 sprintf(buf2,
"%02ld", (
long)(y % 100));
183 sprintf(buf2,
"%02ld", (
long)m);
187 sprintf(buf2,
"%ld", (
long)m);
191 sprintf(buf2,
"%02ld", (
long)d);
195 sprintf(buf2,
"%ld", (
long)d);
199 sprintf(buf2,
"%02ld", (
long)h);
203 sprintf(buf2,
"%ld", (
long)h);
207 sprintf(buf2,
"%02ld", (
long)h2);
211 sprintf(buf2,
"%ld", (
long)h2);
215 sprintf(buf2,
"%02ld", (
long)min);
219 sprintf(buf2,
"%ld", (
long)min);
223 sprintf(buf2,
"%02ld", (
long)s);
227 sprintf(buf2,
"%ld", (
long)s);
250 buf2[0] = format.
data[i];
251 buf2[1] = format.
data[i + 1];
258 buf2[0] = format.
data[i++];
288 return (day + 3) % 7;
E_MhegErr DVB_MhegGetLocalTime(S_DateTime *pDateAndTime)
Provide the current local time and date, normally from the system real time clock, with any local time conversions (if necessary). The returned time should take into account local timezone and daylight saving settings.
MHEG5 engine interface error codes.
U32BIT JulianDate(S32BIT day, S32BIT month, S32BIT year)
The function JulianDate() calculates the julian day number for the specified day, month and year...
Mheg5 logging and debug printing.
MHEG5String MHEG5stringCopyChr(const char *source)
Copy the C-String source to a MHEG5String.
void MHEG5getDate(S32BIT *day, S32BIT *sec)
Modified Julian Date - see Davic 9.2.12.1.
MHEG5String MHEG5formatDate(MHEG5String format, S32BIT day, S32BIT sec)
Format date - See Davic part 9.0 - 9.2.12.1.
S32BIT MHEG5getDayOfWeek(S32BIT day)
Get Day of Week for Davic-Day 0 is Sunday....
References: [1] UK1 Profile - Digital Terrestrial Television - Requirements for interoperability (The...