mktime() fail in auditreduce

Yuan MailList yuan.maillist at gmail.com
Thu Dec 29 08:40:13 GMT 2005


The problem arised from *local time zone*. In my machine, the local time
zone is not setted. There is no* /etc/localtime* file.
I run
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime.
It' OK!


The other way is replace* mktime() *with *timegm()* in auditreduce.c file.

On 12/29/05, Yuan MailList <yuan.maillist at gmail.com> wrote:
>
> The test file is:
>
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <string.h>
> #include <time.h>
>
> int main()
> {
>
>        time_t p_atime;
>        char * optarg = "20051207153440";
>        struct tm tm;
>        strptime(optarg, "%Y%m%d%H%M%S", &tm);
>        p_atime = mktime(&tm);
>        printf("1133969680\n%d\n", p_atime);
>
> }
>
>
>
>  On 12/29/05, Yuan MailList <yuan.maillist at gmail.com> wrote:
> >
> > The mktime() is used in auditreduce.c. But mktime() always return -1.
> > After google the reason, I can not find a way to resolve this problem.
> > Please tell me how to do? thanks.
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freebsd.org/pipermail/trustedbsd-audit/attachments/20051229/c979798e/attachment.html


More information about the trustedbsd-audit mailing list