portable way to deal with 64/32 bit time_t

前端 未结 5 1474
轻奢々
轻奢々 2020-12-06 05:15

I have some code which is built both on Windows and Linux. Linux at this point is always 32bit but Windows is 32 and 64bit. Windows wants to have time_t be 64 bit and Linu

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 06:02

    Slight adjustment on Alok's answer, it's signed on both Windows and Linux, so:

    printf("%lld\n", t);
    

    is cleaner.

提交回复
热议问题