+#ifdef GLK_MODULE_DATETIME
+ case 0x0160: /* current_time */
+ if (arglist[0].ptrflag) {
+ glktimeval_t dat;
+ glk_current_time(&dat);
+ arglist[1].sint = dat.high_sec;
+ arglist[2].uint = dat.low_sec;
+ arglist[3].sint = dat.microsec;
+ }
+ else {
+ glk_current_time(NULL);
+ }
+ break;
+ case 0x0161: /* current_simple_time */
+ arglist[2].sint = glk_current_simple_time(arglist[0].uint);
+ break;
+ case 0x0168: /* time_to_date_utc */ {
+ glktimeval_t timeval;
+ glktimeval_t *timeptr = NULL;
+ glkdate_t date;
+ glkdate_t *dateptr = NULL;
+ int ix = 0;
+ if (arglist[ix++].ptrflag) {
+ timeptr = &timeval;
+ timeval.high_sec = arglist[ix++].sint;
+ timeval.low_sec = arglist[ix++].uint;
+ timeval.microsec = arglist[ix++].sint;
+ }
+ if (arglist[ix++].ptrflag) {
+ dateptr = &date;
+ }
+ glk_time_to_date_utc(timeptr, dateptr);
+ if (dateptr) {
+ arglist[ix++].sint = date.year;
+ arglist[ix++].sint = date.month;
+ arglist[ix++].sint = date.day;
+ arglist[ix++].sint = date.weekday;
+ arglist[ix++].sint = date.hour;
+ arglist[ix++].sint = date.minute;
+ arglist[ix++].sint = date.second;
+ arglist[ix++].sint = date.microsec;
+ }
+ }
+ break;
+ case 0x0169: /* time_to_date_local */ {
+ glktimeval_t timeval;
+ glktimeval_t *timeptr = NULL;
+ glkdate_t date;
+ glkdate_t *dateptr = NULL;
+ int ix = 0;
+ if (arglist[ix++].ptrflag) {
+ timeptr = &timeval;
+ timeval.high_sec = arglist[ix++].sint;
+ timeval.low_sec = arglist[ix++].uint;
+ timeval.microsec = arglist[ix++].sint;
+ }
+ if (arglist[ix++].ptrflag) {
+ dateptr = &date;
+ }
+ glk_time_to_date_local(timeptr, dateptr);
+ if (dateptr) {
+ arglist[ix++].sint = date.year;
+ arglist[ix++].sint = date.month;
+ arglist[ix++].sint = date.day;
+ arglist[ix++].sint = date.weekday;
+ arglist[ix++].sint = date.hour;
+ arglist[ix++].sint = date.minute;
+ arglist[ix++].sint = date.second;
+ arglist[ix++].sint = date.microsec;
+ }
+ }
+ break;
+ case 0x016A: /* simple_time_to_date_utc */ {
+ glkdate_t date;
+ glkdate_t *dateptr = NULL;
+ int ix = 2;
+ if (arglist[ix++].ptrflag) {
+ dateptr = &date;
+ }
+ glk_simple_time_to_date_utc(arglist[0].sint, arglist[1].uint, dateptr);
+ if (dateptr) {
+ arglist[ix++].sint = date.year;
+ arglist[ix++].sint = date.month;
+ arglist[ix++].sint = date.day;
+ arglist[ix++].sint = date.weekday;
+ arglist[ix++].sint = date.hour;
+ arglist[ix++].sint = date.minute;
+ arglist[ix++].sint = date.second;
+ arglist[ix++].sint = date.microsec;
+ }
+ }
+ break;
+ case 0x016B: /* simple_time_to_date_local */ {
+ glkdate_t date;
+ glkdate_t *dateptr = NULL;
+ int ix = 2;
+ if (arglist[ix++].ptrflag) {
+ dateptr = &date;
+ }
+ glk_simple_time_to_date_local(arglist[0].sint, arglist[1].uint, dateptr);
+ if (dateptr) {
+ arglist[ix++].sint = date.year;
+ arglist[ix++].sint = date.month;
+ arglist[ix++].sint = date.day;
+ arglist[ix++].sint = date.weekday;
+ arglist[ix++].sint = date.hour;
+ arglist[ix++].sint = date.minute;
+ arglist[ix++].sint = date.second;
+ arglist[ix++].sint = date.microsec;
+ }
+ }
+ break;
+ case 0x016C: /* date_to_time_utc */ {
+ glkdate_t date;
+ glkdate_t *dateptr = NULL;
+ glktimeval_t timeval;
+ glktimeval_t *timeptr = NULL;
+ int ix = 0;
+ if (arglist[ix++].ptrflag) {
+ dateptr = &date;
+ date.year = arglist[ix++].sint;
+ date.month = arglist[ix++].sint;
+ date.day = arglist[ix++].sint;
+ date.weekday = arglist[ix++].sint;
+ date.hour = arglist[ix++].sint;
+ date.minute = arglist[ix++].sint;
+ date.second = arglist[ix++].sint;
+ date.microsec = arglist[ix++].sint;
+ }
+ if (arglist[ix++].ptrflag) {
+ timeptr = &timeval;
+ }
+ glk_date_to_time_utc(dateptr, timeptr);
+ if (timeptr) {
+ arglist[ix++].sint = timeval.high_sec;
+ arglist[ix++].uint = timeval.low_sec;
+ arglist[ix++].sint = timeval.microsec;
+ }
+ }
+ break;
+ case 0x016D: /* date_to_time_local */ {
+ glkdate_t date;
+ glkdate_t *dateptr = NULL;
+ glktimeval_t timeval;
+ glktimeval_t *timeptr = NULL;
+ int ix = 0;
+ if (arglist[ix++].ptrflag) {
+ dateptr = &date;
+ date.year = arglist[ix++].sint;
+ date.month = arglist[ix++].sint;
+ date.day = arglist[ix++].sint;
+ date.weekday = arglist[ix++].sint;
+ date.hour = arglist[ix++].sint;
+ date.minute = arglist[ix++].sint;
+ date.second = arglist[ix++].sint;
+ date.microsec = arglist[ix++].sint;
+ }
+ if (arglist[ix++].ptrflag) {
+ timeptr = &timeval;
+ }
+ glk_date_to_time_local(dateptr, timeptr);
+ if (timeptr) {
+ arglist[ix++].sint = timeval.high_sec;
+ arglist[ix++].uint = timeval.low_sec;
+ arglist[ix++].sint = timeval.microsec;
+ }
+ }
+ break;
+ case 0x016E: /* date_to_simple_time_utc */ {
+ glkdate_t date;
+ glkdate_t *dateptr = NULL;
+ int ix = 0;
+ if (arglist[ix++].ptrflag) {
+ dateptr = &date;
+ date.year = arglist[ix++].sint;
+ date.month = arglist[ix++].sint;
+ date.day = arglist[ix++].sint;
+ date.weekday = arglist[ix++].sint;
+ date.hour = arglist[ix++].sint;
+ date.minute = arglist[ix++].sint;
+ date.second = arglist[ix++].sint;
+ date.microsec = arglist[ix++].sint;
+ }
+ arglist[ix+2].sint = glk_date_to_simple_time_utc(dateptr, arglist[ix].uint);
+ }
+ break;
+ case 0x016F: /* date_to_simple_time_local */ {
+ glkdate_t date;
+ glkdate_t *dateptr = NULL;
+ int ix = 0;
+ if (arglist[ix++].ptrflag) {
+ dateptr = &date;
+ date.year = arglist[ix++].sint;
+ date.month = arglist[ix++].sint;
+ date.day = arglist[ix++].sint;
+ date.weekday = arglist[ix++].sint;
+ date.hour = arglist[ix++].sint;
+ date.minute = arglist[ix++].sint;
+ date.second = arglist[ix++].sint;
+ date.microsec = arglist[ix++].sint;
+ }
+ arglist[ix+2].sint = glk_date_to_simple_time_local(dateptr, arglist[ix].uint);
+ }
+ break;
+#endif /* GLK_MODULE_DATETIME */
+
+#ifdef GLK_MODULE_RESOURCE_STREAM
+ case 0x0049: /* stream_open_resource */
+ arglist[3].opaqueref = glk_stream_open_resource(arglist[0].uint, arglist[1].uint);
+ break;
+ case 0x013A: /* stream_open_resource_uni */
+ arglist[3].opaqueref = glk_stream_open_resource_uni(arglist[0].uint, arglist[1].uint);
+ break;
+#endif /* GLK_MODULE_RESOURCE_STREAM */
+