{"id":93,"date":"2014-07-03T13:56:32","date_gmt":"2014-07-03T13:56:32","guid":{"rendered":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/?p=93"},"modified":"2014-07-04T16:26:33","modified_gmt":"2014-07-04T16:26:33","slug":"the-ovm_timeval_t-type","status":"publish","type":"post","link":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/?p=93","title":{"rendered":"The ovm_timeval_t type"},"content":{"rendered":"<p>The <code>ovm_timeval_t<\/code> type is the OrchIDS incarnation of the data type <code>struct timeval<\/code> of times and durations.<!--more--><\/p>\n<p>It is defined this way in <tt>src\/lang.h<\/tt>:<\/p>\n<pre>typedef struct ovm_timeval_s ovm_timeval_t;\r\nstruct ovm_timeval_s\r\n{\r\n  gc_header_t gc;\r\n  struct timeval time;\r\n};<\/pre>\n<p>This is a type of <a title=\"Garbage collection\" href=\"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/?p=18\">garbage-collectable<\/a> data. To allocate a new object of type <code>ovm_timeval_t<\/code>, use the function:<\/p>\n<pre>ovm_var_t *ovm_timeval_new(gc_t *gc_ctx);<\/pre>\n<p>This creates a new <code>ovm_timeval_t<\/code> object at the time of the epoch (<code>tv_sec<\/code>=<code>tv_usec<\/code>=0). Its return type is the universal type <a title=\"The ovm_var_t universal type\" href=\"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/?page_id=121\"><code>ovm_var_t<\/code><\/a> instead of <code>ovm_timeval_t<\/code>, for practical reasons. Calling <code>res<\/code> the result, one always has <code>TYPE(res)==T_TIMEVAL<\/code>.<\/p>\n<p>The result is created white, and much be <code>gc_touch()<\/code>ed before storing it into a garbage-collectable object.<\/p>\n<p>The returned <code>ovm_timeval_t<\/code> object <code>res<\/code> is modifiable. One can read from or write from it by using the <code>TIMEVAL()<\/code> macro (e.g., <code>long sec=TIMEVAL(res).tv_sec, usec=TIMEVAL(res).tv_usec; TIMEVAL(res).tv_sec = 352; TIMEVAL(res).tv_usec = 537260;<\/code>).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ovm_timeval_t type is the OrchIDS incarnation of the data type struct timeval of times and durations.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-93","post","type-post","status-publish","format-standard","hentry","category-data-types","category-virtual-machine"],"_links":{"self":[{"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/posts\/93","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=93"}],"version-history":[{"count":3,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/posts\/93\/revisions"}],"predecessor-version":[{"id":128,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/posts\/93\/revisions\/128"}],"wp:attachment":[{"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=93"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=93"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=93"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}