mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge Richard Cohen's 'fix-gnc-mktime' into stable.
This commit is contained in:
commit
e3d682c0e5
@ -69,9 +69,8 @@ typedef char gchar;
|
||||
%typemap(in) time64 * (time64 t) "t = scm_to_int64($input); $1 = &t;"
|
||||
%typemap(out) time64 * " $result = ($1) ? scm_from_int64(*($1)) : SCM_BOOL_F; "
|
||||
|
||||
%typemap(in) struct tm * (struct tm t) {
|
||||
%typemap(in) struct tm * (struct tm t, char *tzone) {
|
||||
SCM tm = $input;
|
||||
SCM zone;
|
||||
t.tm_sec = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 0));
|
||||
t.tm_min = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 1));
|
||||
t.tm_hour = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 2));
|
||||
@ -83,11 +82,17 @@ typedef char gchar;
|
||||
t.tm_isdst = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 8));
|
||||
%#ifdef HAVE_STRUCT_TM_GMTOFF
|
||||
t.tm_gmtoff = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 9));
|
||||
zone = SCM_SIMPLE_VECTOR_REF(tm, 10);
|
||||
t.tm_zone = SCM_UNBNDP(zone) ? NULL : scm_to_locale_string(zone);
|
||||
SCM zone = SCM_SIMPLE_VECTOR_REF(tm, 10);
|
||||
tzone = SCM_UNBNDP(zone) ? NULL : scm_to_locale_string(zone);
|
||||
t.tm_zone = tzone;
|
||||
%#endif
|
||||
$1 = &t;
|
||||
}
|
||||
%typemap(freearg) struct tm * {
|
||||
%#ifdef HAVE_STRUCT_TM_GMTOFF
|
||||
free(tzone$argnum);
|
||||
%#endif
|
||||
}
|
||||
|
||||
%typemap(out) struct tm * {
|
||||
SCM tm = scm_c_make_vector(11, SCM_UNDEFINED);
|
||||
@ -116,30 +121,6 @@ typedef char gchar;
|
||||
|
||||
%typemap(newfree) struct tm * "gnc_tm_free($1);"
|
||||
|
||||
%typemap(argout) struct tm * {
|
||||
struct tm* t = $1;
|
||||
SCM tm = $input;
|
||||
if (t == NULL)
|
||||
{
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 0, scm_from_int(t->tm_sec));
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 1, scm_from_int(t->tm_min));
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 2, scm_from_int(t->tm_hour));
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 3, scm_from_int(t->tm_mday));
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 4, scm_from_int(t->tm_mon));
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 5, scm_from_int(t->tm_year));
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 6, scm_from_int(t->tm_wday));
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 7, scm_from_int(t->tm_yday));
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 8, scm_from_int(t->tm_isdst));
|
||||
%#ifdef HAVE_STRUCT_TM_GMTOFF
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 9, scm_from_long(t->tm_gmtoff));
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 10, scm_from_locale_string(t->tm_zone?t->tm_zone:"Unset"));
|
||||
%#else
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 9, scm_from_long(0));
|
||||
SCM_SIMPLE_VECTOR_SET(tm, 10, scm_from_locale_string("GMT"));
|
||||
%#endif
|
||||
}
|
||||
}
|
||||
|
||||
%define GLIST_HELPER_INOUT(ListType, ElemSwigType)
|
||||
%typemap(in) ListType * {
|
||||
SCM list = $input;
|
||||
|
Loading…
Reference in New Issue
Block a user