/* * Date provider selection * * User may define DUK_USE_DATE_GET_NOW() etc directly, in which case we'll * rely on an external provider. If this is not done, revert to previous * behavior and use Unix/Windows built-in provider. */ #if defined(DUK_COMPILING_DUKTAPE) #if defined(DUK_USE_DATE_GET_NOW) /* External provider already defined. */ #elif defined(DUK_USE_DATE_NOW_GETTIMEOFDAY) #define DUK_USE_DATE_GET_NOW(ctx) duk_bi_date_get_now_gettimeofday((ctx)) #elif defined(DUK_USE_DATE_NOW_TIME) #define DUK_USE_DATE_GET_NOW(ctx) duk_bi_date_get_now_time((ctx)) #elif defined(DUK_USE_DATE_NOW_WINDOWS) #define DUK_USE_DATE_GET_NOW(ctx) duk_bi_date_get_now_windows((ctx)) #else #error no provider for DUK_USE_DATE_GET_NOW() #endif #if defined(DUK_USE_DATE_GET_LOCAL_TZOFFSET) /* External provider already defined. */ #elif defined(DUK_USE_DATE_TZO_GMTIME_R) || defined(DUK_USE_DATE_TZO_GMTIME) #define DUK_USE_DATE_GET_LOCAL_TZOFFSET(d) duk_bi_date_get_local_tzoffset_gmtime((d)) #elif defined(DUK_USE_DATE_TZO_WINDOWS) #define DUK_USE_DATE_GET_LOCAL_TZOFFSET(d) duk_bi_date_get_local_tzoffset_windows((d)) #else #error no provider for DUK_USE_DATE_GET_LOCAL_TZOFFSET() #endif #if defined(DUK_USE_DATE_PARSE_STRING) /* External provider already defined. */ #elif defined(DUK_USE_DATE_PRS_STRPTIME) #define DUK_USE_DATE_PARSE_STRING(ctx,str) duk_bi_date_parse_string_strptime((ctx), (str)) #elif defined(DUK_USE_DATE_PRS_GETDATE) #define DUK_USE_DATE_PARSE_STRING(ctx,str) duk_bi_date_parse_string_getdate((ctx), (str)) #else /* No provider for DUK_USE_DATE_PARSE_STRING(), fall back to ISO 8601 only. */ #endif #if defined(DUK_USE_DATE_FORMAT_STRING) /* External provider already defined. */ #elif defined(DUK_USE_DATE_FMT_STRFTIME) #define DUK_USE_DATE_FORMAT_STRING(ctx,parts,tzoffset,flags) \ duk_bi_date_format_parts_strftime((ctx), (parts), (tzoffset), (flags)) #else /* No provider for DUK_USE_DATE_FORMAT_STRING(), fall back to ISO 8601 only. */ #endif #endif /* DUK_COMPILING_DUKTAPE */