foreign interface (basic ignorance at the simplest level) pasted by tty0p0 on Tue Nov 5 18:22:40 2019

(import (chicken foreign))

#>
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
<#

(define-foreign-type time_t "time_t")

(define strftime
	(foreign-lambda size_t "strftime" (c-pointer char) size_t c-string (c-pointer (struct tm))) )
(define gmtime
	(foreign-lambda (c-pointer (struct tm)) "gmtime" (const (c-pointer unsigned-integer64))) )
(define time (foreign-lambda time_t "time" (c-pointer time_t)))
(define-foreign-type time-str "char[1024]")

(let-location ((buf0 time-str))
	(let*
		((t0 (time-get #f))
			(z0 (strftime buf0 1024 "%FT%T" (gmtime (location t0)))) )
		(if (equal? z0 0)
			(error "not working")
			(display buf0) )
		(newline) ))

foreign code; close but not quite added by tty0p0 on Tue Nov 5 20:13:05 2019

(import (chicken foreign) (chicken blob))

#>
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
<#

(define-foreign-type time_t unsigned-integer64)

(define strftime
	(foreign-lambda size_t "strftime" (c-pointer char) size_t c-string (c-pointer (struct tm))) )
(define gmtime
	(foreign-lambda (c-pointer (struct tm)) "gmtime" (c-pointer time_t)) )
(define time-get (foreign-lambda time_t "time" (c-pointer time_t)))

(let ((buf0 (make-string 256)))
	(let-location ((t0 time_t (time-get #f)))
		(let ((z0 (strftime (location buf0) 256 "%FT%T" (gmtime (location t0)))))
				(if (equal? z0 0)
					(error "not working")
					(begin (write buf0) (newline)) ))))