The C standard only states that time_t is an integer (or floating-point) type, and POSIX further states it represents seconds since the epoch, so a 64-bit time_t is a good solution.<p>In order to find and change occurrences of time_t in ports more easily, they could use the Coccinelle tool.[1] The following semantic patch would find and replace variable declarations of type time_t:<p><pre><code> @sys_types@
@@
#include <sys/types.h>
@time_t depends on sys_types@
identifier x;
@@
- time_t x
+ long long int x
;
</code></pre>
Replacing printf format specifiers is more difficult, so the following semantic patch will find printf statements which use time_t variables, which can then be edited manually:<p><pre><code> @sys_types@
@@
#include <sys/types.h>
@stdio@
@@
#include <stdio.h>
@printf depends on sys_types && stdio@
identifier x;
@@
time_t x;
...
* printf(..., x, ...);
</code></pre>
These can be used as follows:<p><pre><code> $ spatch --sp-file foo.cocci --dir /path/to/ports
</code></pre>
where `foo.cocci` is the name of one of the semantic patches above.<p>[1] <a href="http://coccinelle.lip6.fr/" rel="nofollow">http://coccinelle.lip6.fr/</a>