The ovm_ctime_t type

The ovm_ctime_t type is the OrchIDS incarnation of the data type time_t of times (not durations: durations are represented as machine integers, of type ovm_int_t).

It is defined this way in src/lang.h:

typedef struct ovm_ctime_s ovm_ctime_t;
struct ovm_ctime_s
  gc_header_t gc;
  time_t    time;

This is a type of garbage-collectable data. To allocate a new object of type ovm_ctime_t, use the function:

ovm_var_t *ovm_ctime_new(gc_t *gc_ctx, time_t tm);

This creates a new ovm_ctime_t object with value tm. Its return type is the universal type ovm_var_t instead of ovm_ctime_t, for practical reasons. Calling res the result, one always has TYPE(res)==T_CTIME.

The result is created white, and much be gc_touch()ed before storing it into a garbage-collectable object.

The returned ovm_ctime_t object res is modifiable. One can read from or write from it by using the CTIME() macro (e.g., time_t t=CTIME(res); CTIME(res) = t;).