以下の例で、現在時間の取得方法、時間差の取得を説明する #include <time.h> #include <stdio.h> #include <unistd.h> int main() { time_t start ,end ; double cost; time(&start); sleep(1);//1秒をsleep time(&end); cost=difftime(end,start); printf("%f/n",cost); return 0; } 月額たった 1,050円で始められる本格的なお店のホームページ! コメント: |