{"id":2693,"date":"2020-01-10T18:43:39","date_gmt":"2020-01-10T17:43:39","guid":{"rendered":"https:\/\/ridgesolutions.ie\/?p=2693"},"modified":"2022-05-17T16:10:19","modified_gmt":"2022-05-17T15:10:19","slug":"creating-time_t-value-from-a-utc-date-and-time-in-c","status":"publish","type":"post","link":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/","title":{"rendered":"Creating time_t value from a UTC date and time in C"},"content":{"rendered":"<p>Programming with time is difficult and error prone, for this reason I usually try to keep things in UTC so that I don&#8217;t have to worry about time zones and daylight saving offsets etc.<\/p>\n<p>When in C++ I mostly use the boost::ptime library but I was surprised recently about tricky it seemed to be to initialise a time_t value for an arbitrary UTC time just using the standard C\/C++ libs.\u00a0We can&#8217;t use mktime() as it will figure out which time zone you&#8217;re in and assume that the time values you have passed refer to this zone, it will also apply daylight saving offsets.<\/p>\n<p>Anyway to cut a long story short there are no standard functions in the C lib for this, instead your either have to use the posix timegm() function on Unix-like systems and _mkgmtime() on windows systems.<\/p>\n<p>Here is an example, lets say we want to initialise a time_t value for this UTC date\/time: 01\/10\/2020 10:16:03 (10th. Jan 2020)<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\">#include &lt;assert.h&gt;\r\n#include &lt;time.h&gt;\r\n\r\n#ifndef timegm\r\n\/\/ use _mkgmtime() on windows\r\n#define timegm _mkgmtime\r\n#endif\r\n\r\nvoid test_utc() {\r\n\r\nstruct tm utc;\r\ntime_t tim;\r\nstruct tm* utc_out;\r\n\r\n\/\/ Want to create a time_t value for UTC:\r\n\/\/ 01\/10\/2020 10:16:03\r\n\r\n\/\/ tm_year is time since 1900\r\nutc.tm_year = 2020 - 1900;\r\n\r\n\/\/ Month is zero based, i.e. Jan is month 0\r\nutc.tm_mon = 1 - 1;\r\nutc.tm_mday = 10;\r\nutc.tm_hour = 10;\r\nutc.tm_min = 16;\r\nutc.tm_sec = 03;\r\nutc.tm_isdst = 0;\r\n\r\n\/\/ Get time_t val for the UTC date\/time\r\ntim = timegm(&amp;utc); \/\/ or _mkgmtime() on windows\r\n\r\n\/\/ Now let's use gmtime() to check all is ok\r\n\/\/ by retrieving a UTC tm struct and comparing\r\n\/\/ with original\r\n\r\nutc_out = gmtime(&amp;tim);\r\n\r\nassert(utc.tm_year == utc_out-&gt;tm_year);\r\nassert(utc.tm_mon == utc_out-&gt;tm_mon);\r\nassert(utc.tm_mday == utc_out-&gt;tm_mday);\r\nassert(utc.tm_hour == utc_out-&gt;tm_hour);\r\nassert(utc.tm_min == utc_out-&gt;tm_min);\r\nassert(utc.tm_sec == utc_out-&gt;tm_sec);\r\n}<\/pre>\n<p>That seems to do the trick, although I am astounded that this isn&#8217;t covered by the standard lib. To achieve the same using just the standard lib it seems you have to either hack around with the timezone env. variable before calling mktime() or assume you know how the time_t val is constructed and build your own timegm() function&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Programming with time is difficult and error prone, for this reason I usually try to keep things in UTC so that I don&#8217;t have to worry about time zones and daylight saving offsets etc. When in C++ I mostly use the boost::ptime library but I was surprised recently about tricky it seemed to be to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[301],"tags":[],"class_list":["post-2693","post","type-post","status-publish","format-standard","hentry","category-by-kevin-godden"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Programming with time is difficult and error prone, for this reason I usually try to keep things in UTC so that I don&#039;t have to worry about time zones and daylight saving offsets etc. When in C++ I mostly use the boost::ptime library but I was surprised recently about tricky it seemed to be to\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Kevin Godden\"\/>\n\t<meta name=\"google-site-verification\" content=\"Kyj52YLp6GOPA44PVBffo9fjW8rgWHYYRF0ZYjfy6ss\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Systems and Embedded Software Engineering, Ireland. | Some thoughts of a busy Computer Engineer\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Creating time_t value from a UTC date and time in C\" \/>\n\t\t<meta property=\"og:description\" content=\"Programming with time is difficult and error prone, for this reason I usually try to keep things in UTC so that I don&#039;t have to worry about time zones and daylight saving offsets etc. When in C++ I mostly use the boost::ptime library but I was surprised recently about tricky it seemed to be to\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-01-10T17:43:39+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-05-17T15:10:19+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Creating time_t value from a UTC date and time in C\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Programming with time is difficult and error prone, for this reason I usually try to keep things in UTC so that I don&#039;t have to worry about time zones and daylight saving offsets etc. When in C++ I mostly use the boost::ptime library but I was surprised recently about tricky it seemed to be to\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/#article\",\"name\":\"Creating time_t value from a UTC date and time in C\",\"headline\":\"Creating time_t value from a UTC date and time in C\",\"author\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/author\\\/kgodden\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/wp-content\\\/uploads\\\/2013\\\/09\\\/ridge_logo1.jpg\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#articleImage\",\"width\":400,\"height\":81},\"datePublished\":\"2020-01-10T18:43:39+00:00\",\"dateModified\":\"2022-05-17T16:10:19+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/#webpage\"},\"articleSection\":\"By Ridge Solutions\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.ridgesolutions.ie\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/category\\\/by-kevin-godden\\\/#listItem\",\"name\":\"By Ridge Solutions\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/category\\\/by-kevin-godden\\\/#listItem\",\"position\":2,\"name\":\"By Ridge Solutions\",\"item\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/category\\\/by-kevin-godden\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/#listItem\",\"name\":\"Creating time_t value from a UTC date and time in C\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/#listItem\",\"position\":3,\"name\":\"Creating time_t value from a UTC date and time in C\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/category\\\/by-kevin-godden\\\/#listItem\",\"name\":\"By Ridge Solutions\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#organization\",\"name\":\"Ridge Solutions, Software Development and Software Engineering, Ireland.\",\"description\":\"Some thoughts of a busy Computer Engineer\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/wp-content\\\/uploads\\\/2013\\\/09\\\/ridge_logo1.jpg\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/#organizationLogo\",\"width\":400,\"height\":81},\"image\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/#organizationLogo\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/author\\\/kgodden\\\/#author\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/author\\\/kgodden\\\/\",\"name\":\"Kevin Godden\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d2833f41e59a25cf2a9741a05ec383bfdd278762a5e0798a90940e7ab0a107a2?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Kevin Godden\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/#webpage\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/\",\"name\":\"Creating time_t value from a UTC date and time in C\",\"description\":\"Programming with time is difficult and error prone, for this reason I usually try to keep things in UTC so that I don't have to worry about time zones and daylight saving offsets etc. When in C++ I mostly use the boost::ptime library but I was surprised recently about tricky it seemed to be to\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2020\\\/01\\\/10\\\/creating-time_t-value-from-a-utc-date-and-time-in-c\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/author\\\/kgodden\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/author\\\/kgodden\\\/#author\"},\"datePublished\":\"2020-01-10T18:43:39+00:00\",\"dateModified\":\"2022-05-17T16:10:19+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#website\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/\",\"name\":\"Ridge Solutions, Software Development and Software Engineering, Ireland.\",\"description\":\"Some thoughts of a busy Computer Engineer\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Creating time_t value from a UTC date and time in C","description":"Programming with time is difficult and error prone, for this reason I usually try to keep things in UTC so that I don't have to worry about time zones and daylight saving offsets etc. When in C++ I mostly use the boost::ptime library but I was surprised recently about tricky it seemed to be to","canonical_url":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"Kyj52YLp6GOPA44PVBffo9fjW8rgWHYYRF0ZYjfy6ss","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/#article","name":"Creating time_t value from a UTC date and time in C","headline":"Creating time_t value from a UTC date and time in C","author":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/author\/kgodden\/#author"},"publisher":{"@id":"https:\/\/www.ridgesolutions.ie\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.ridgesolutions.ie\/wp-content\/uploads\/2013\/09\/ridge_logo1.jpg","@id":"https:\/\/www.ridgesolutions.ie\/#articleImage","width":400,"height":81},"datePublished":"2020-01-10T18:43:39+00:00","dateModified":"2022-05-17T16:10:19+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/#webpage"},"isPartOf":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/#webpage"},"articleSection":"By Ridge Solutions"},{"@type":"BreadcrumbList","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie#listItem","position":1,"name":"Home","item":"https:\/\/www.ridgesolutions.ie","nextItem":{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/category\/by-kevin-godden\/#listItem","name":"By Ridge Solutions"}},{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/category\/by-kevin-godden\/#listItem","position":2,"name":"By Ridge Solutions","item":"https:\/\/www.ridgesolutions.ie\/index.php\/category\/by-kevin-godden\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/#listItem","name":"Creating time_t value from a UTC date and time in C"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/#listItem","position":3,"name":"Creating time_t value from a UTC date and time in C","previousItem":{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/category\/by-kevin-godden\/#listItem","name":"By Ridge Solutions"}}]},{"@type":"Organization","@id":"https:\/\/www.ridgesolutions.ie\/#organization","name":"Ridge Solutions, Software Development and Software Engineering, Ireland.","description":"Some thoughts of a busy Computer Engineer","url":"https:\/\/www.ridgesolutions.ie\/","logo":{"@type":"ImageObject","url":"https:\/\/www.ridgesolutions.ie\/wp-content\/uploads\/2013\/09\/ridge_logo1.jpg","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/#organizationLogo","width":400,"height":81},"image":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/#organizationLogo"}},{"@type":"Person","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/author\/kgodden\/#author","url":"https:\/\/www.ridgesolutions.ie\/index.php\/author\/kgodden\/","name":"Kevin Godden","image":{"@type":"ImageObject","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/d2833f41e59a25cf2a9741a05ec383bfdd278762a5e0798a90940e7ab0a107a2?s=96&d=mm&r=g","width":96,"height":96,"caption":"Kevin Godden"}},{"@type":"WebPage","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/#webpage","url":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/","name":"Creating time_t value from a UTC date and time in C","description":"Programming with time is difficult and error prone, for this reason I usually try to keep things in UTC so that I don't have to worry about time zones and daylight saving offsets etc. When in C++ I mostly use the boost::ptime library but I was surprised recently about tricky it seemed to be to","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.ridgesolutions.ie\/#website"},"breadcrumb":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/#breadcrumblist"},"author":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/author\/kgodden\/#author"},"creator":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/author\/kgodden\/#author"},"datePublished":"2020-01-10T18:43:39+00:00","dateModified":"2022-05-17T16:10:19+00:00"},{"@type":"WebSite","@id":"https:\/\/www.ridgesolutions.ie\/#website","url":"https:\/\/www.ridgesolutions.ie\/","name":"Ridge Solutions, Software Development and Software Engineering, Ireland.","description":"Some thoughts of a busy Computer Engineer","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.ridgesolutions.ie\/#organization"}}]},"og:locale":"en_US","og:site_name":"Systems and Embedded Software Engineering, Ireland. | Some thoughts of a busy Computer Engineer","og:type":"article","og:title":"Creating time_t value from a UTC date and time in C","og:description":"Programming with time is difficult and error prone, for this reason I usually try to keep things in UTC so that I don't have to worry about time zones and daylight saving offsets etc. When in C++ I mostly use the boost::ptime library but I was surprised recently about tricky it seemed to be to","og:url":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/","article:published_time":"2020-01-10T17:43:39+00:00","article:modified_time":"2022-05-17T15:10:19+00:00","twitter:card":"summary","twitter:title":"Creating time_t value from a UTC date and time in C","twitter:description":"Programming with time is difficult and error prone, for this reason I usually try to keep things in UTC so that I don't have to worry about time zones and daylight saving offsets etc. When in C++ I mostly use the boost::ptime library but I was surprised recently about tricky it seemed to be to"},"aioseo_meta_data":{"post_id":"2693","title":null,"description":null,"keywords":[{"label":"utc","value":"utc"},{"label":"utc time","value":"utc time"},{"label":"C","value":"C"},{"label":"timegm","value":"timegm"},{"label":"gmtime","value":"gmtime"},{"label":"mktime","value":"mktime"}],"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"aioseo-article-634e729044a3c","slug":"article","graphName":"Article","label":"Article","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-09-13 11:19:05","updated":"2026-08-07 16:46:47","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.ridgesolutions.ie\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.ridgesolutions.ie\/index.php\/category\/by-kevin-godden\/\" title=\"By Ridge Solutions\">By Ridge Solutions<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tCreating time_t value from a UTC date and time in C\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.ridgesolutions.ie"},{"label":"By Ridge Solutions","link":"https:\/\/www.ridgesolutions.ie\/index.php\/category\/by-kevin-godden\/"},{"label":"Creating time_t value from a UTC date and time in C","link":"https:\/\/www.ridgesolutions.ie\/index.php\/2020\/01\/10\/creating-time_t-value-from-a-utc-date-and-time-in-c\/"}],"_links":{"self":[{"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/posts\/2693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/comments?post=2693"}],"version-history":[{"count":0,"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/posts\/2693\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/media?parent=2693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/categories?post=2693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/tags?post=2693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}