Vanilla.PDF  1.6.0
Cross-platform toolkit for creating and modifying PDF documents
Print date
error_type process_date(DateHandle* obj, int nested) {
integer_type year = 0;
integer_type month = 0;
integer_type day = 0;
integer_type hour = 0;
integer_type minute = 0;
integer_type second = 0;
TimezoneType timezone;
integer_type hour_offset = 0;
integer_type minute_offset = 0;
print_spaces(nested);
print_text("Date begin\n");
RETURN_ERROR_IF_NOT_SUCCESS(Date_GetYear(obj, &year));
RETURN_ERROR_IF_NOT_SUCCESS(Date_GetMonth(obj, &month));
RETURN_ERROR_IF_NOT_SUCCESS(Date_GetDay(obj, &day));
RETURN_ERROR_IF_NOT_SUCCESS(Date_GetHour(obj, &hour));
RETURN_ERROR_IF_NOT_SUCCESS(Date_GetMinute(obj, &minute));
RETURN_ERROR_IF_NOT_SUCCESS(Date_GetSecond(obj, &second));
RETURN_ERROR_IF_NOT_SUCCESS(Date_GetTimezone(obj, &timezone));
RETURN_ERROR_IF_NOT_SUCCESS(Date_GetHourOffset(obj, &hour_offset));
RETURN_ERROR_IF_NOT_SUCCESS(Date_GetMinuteOffset(obj, &minute_offset));
print_spaces(nested + 1);
if (timezone == TimezoneType_UTC) {
print_text("%04d-%02d-%02d %02d:%02d:%02dZ\n",
year, month, day,
hour, minute, second);
} else {
char timezone_character;
if (timezone == TimezoneType_Later) {
timezone_character = '+';
} else if (timezone == TimezoneType_Earlier) {
timezone_character = '-';
} else {
print_text("Timezone is neither UTC, Earlier nor later\n");
return VANILLAPDF_TEST_ERROR_FAILURE;
}
print_text("%04d-%02d-%02d %02d:%02d:%02d %c%02d:%02d\n",
year, month, day,
hour, minute, second,
timezone_character, hour_offset, minute_offset);
}
print_spaces(nested);
print_text("Date end\n");
return VANILLAPDF_TEST_ERROR_SUCCESS;
}
TimezoneType
Relationship of local time to Universal Time (UT).
Definition: c_date.h:28
@ TimezoneType_Later
Signifies that local time is later than UT.
Definition: c_date.h:43
@ TimezoneType_Earlier
Signifies that local time is earlier than UT.
Definition: c_date.h:48
@ TimezoneType_UTC
Signifies that local time is equal to UT.
Definition: c_date.h:38
Represents a reference to a particular day represented within a calendar system.
error_type CALLING_CONVENTION Date_GetDay(DateHandle *handle, integer_type *result)
Get day index in month represented by this object. Range of values (1-31)
error_type CALLING_CONVENTION Date_GetHour(DateHandle *handle, integer_type *result)
Get hours in day represented by this object. Range of values (0-23)
error_type CALLING_CONVENTION Date_GetTimezone(DateHandle *handle, TimezoneType *result)
Relationship of local time to Universal Time (UT).
error_type CALLING_CONVENTION Date_GetSecond(DateHandle *handle, integer_type *result)
Get seconds represented by this object. Range of values (0-59)
error_type CALLING_CONVENTION Date_GetYear(DateHandle *handle, integer_type *result)
Get year represented by this object.
error_type CALLING_CONVENTION Date_GetHourOffset(DateHandle *handle, integer_type *result)
Get hour offset represented by this object. Range of values (0-23)
error_type CALLING_CONVENTION Date_GetMonth(DateHandle *handle, integer_type *result)
Get month in specified year represented by this object. Range of values (1-12)
error_type CALLING_CONVENTION Date_GetMinute(DateHandle *handle, integer_type *result)
Get minutes represented by this object. Range of values (0-59)
error_type CALLING_CONVENTION Date_GetMinuteOffset(DateHandle *handle, integer_type *result)
Get minute offset represented by this object. Range of values (0-59)
uint32_t error_type
This is return value type of all API functions.
Definition: c_types.h:25
int32_t integer_type
32-bit signed integer
Definition: c_types.h:51