Date: Mon, 21 Jan 2008 15:26:43 GMT From: "Dmitrij N.Babin" <was.drum@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/119862: Incorrect mktime() work Message-ID: <200801211526.m0LFQhnn069707@www.freebsd.org> Resent-Message-ID: <200801211530.m0LFU73f071480@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 119862 >Category: bin >Synopsis: Incorrect mktime() work >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jan 21 15:30:07 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Dmitrij N.Babin >Release: 6.2, 4.11 >Organization: online.ua >Environment: FreeBSD drummy 6.2-RELEASE-p7 FreeBSD 6.2-RELEASE-p7 #3: Fri Sep 28 18:27:53 EEST 2007 root@drummy:/usr/obj/usr/src/sys/DRUMMY amd64 FreeBSD hz.albur-online.com 4.11-RELEASE FreeBSD 4.11-RELEASE #0: Fri Jan 21 17:21:22 GMT 2005 root@perseus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: #include <stdio.h> #include <time.h> struct tm tf,tt,tt2; main() { time_t t_f, t_t, t_t2; int days, days2; /*---*/ tf.tm_sec=tt.tm_sec=tt2.tm_sec=0; tf.tm_min=tt.tm_min=tt2.tm_min=0; tf.tm_hour=tt.tm_hour=tt2.tm_hour=0; /*---*/ tf.tm_year=tt.tm_year=tt2.tm_year=2008-1900; /* Year - 2008 */ tf.tm_mon=2; /* February */ tt.tm_mon=2; tt2.tm_mon=3; /* March */ /*---*/ tf.tm_mday=1; tt.tm_mday=29; tt2.tm_mday=1; /*---*/ t_f=mktime(&tf); t_t=mktime(&tt); t_t2=mktime(&tt2); days=(t_t-t_f)/86400+1; days2=(t_t2-t_f)/86400+1; printf("\nFrom 1-02 to 29-02 full days:%u\nFrom 1-02 to 1-03 full days:%u\n",days,days2); } drum@drummy> cc ttt3.c drum@drummy> ./a.out >From 1-02 to 29-02 full days:29 >From 1-02 to 1-03 full days:32 >How-To-Repeat: just compile and run >Fix: dont know >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801211526.m0LFQhnn069707>