{"height":"190","url":"https://iww.hateblo.jp/entry/20220523/uptime","blog_title":"\u63ee\u767a\u6027\u306e\u30e1\u30e2\uff12","provider_url":"https://hatena.blog","provider_name":"Hatena Blog","width":"100%","type":"rich","published":"2022-05-24 08:30:00","title":" [C][Linux] C\u3067uptime\u3092\u66f8\u304f","author_name":"iww","image_url":"https://cdn.user.blog.st-hatena.com/default_entry_og_image/42132/1577169589465165","categories":["C","Linux"],"version":"1.0","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fiww.hateblo.jp%2Fentry%2F20220523%2Fuptime\" title=\" [C][Linux] C\u3067uptime\u3092\u66f8\u304f - \u63ee\u767a\u6027\u306e\u30e1\u30e2\uff12\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","author_url":"https://blog.hatena.ne.jp/iww/","blog_url":"https://iww.hateblo.jp/","description":"clock_gettime() \u3092\u4f7f\u3046 Man page of CLOCK_GETRES CLOCK_MONOTONIC_COARSE \u304b CLOCK_MONOTONIC \u3092\u4f7f\u3046\u3068\u8d77\u52d5\u7d4c\u904e\u6642\u9593\u304c\u53d6\u308c\u308b \u79d2\u307e\u3067\u306a\u3089 CLOCK_MONOTONIC_COARSE \u3067\u3044\u3044 #include <time.h> // clock_gettime time_t uptime() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC_COARSE, &ts); return ts.tv_sec; } #include <stdio.h> int main()\u2026"}