From owner-freebsd-questions@FreeBSD.ORG Tue Oct 14 18:46:24 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 930AD106568B for ; Tue, 14 Oct 2008 18:46:24 +0000 (UTC) (envelope-from mkbucc@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.29]) by mx1.freebsd.org (Postfix) with ESMTP id 4C6638FC0A for ; Tue, 14 Oct 2008 18:46:24 +0000 (UTC) (envelope-from mkbucc@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so561041ywe.13 for ; Tue, 14 Oct 2008 11:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=O8fejC71F55PsPHFpFg/fp+KzMz/+cUHVEoCIUoOT5M=; b=pmbS8gX3XIks+bGt+eIadWySpxL8LaoZrfOmfwoRJL9I7y9nKl3s+MtgOA10t14GDe fDMqPszw37Xa4GmuR2cUCPxKb2H7Z266lPO8XXL8dmtbRyassNzkYZYagspojd6nVlKx yzQpK3yUtGzJGw/K6SqJvyzB0P4uGmLhGtTU4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=cF0kyju4XoOQ6LHcws6Ul0BREB4n177HRtPGai1sO9+U05ZoZrV1pPkThncn5Pe71W A19yCBXkrqErUGQO381z4vr+Z7RmwXakz9S5KtFKa9+6mfiXUWdnEFmnDYwdmQ2Okeaj X5tfHKOiOGenBANnz/0b0B6VfTWqNXhwCxfYA= Received: by 10.142.226.2 with SMTP id y2mr20333wfg.80.1224009983114; Tue, 14 Oct 2008 11:46:23 -0700 (PDT) Received: by 10.142.147.14 with HTTP; Tue, 14 Oct 2008 11:46:23 -0700 (PDT) Message-ID: <59f4cb420810141146r53c7527i8becf67ece89ab95@mail.gmail.com> Date: Tue, 14 Oct 2008 14:46:23 -0400 From: "Mark B." To: "Jeremy Chadwick" In-Reply-To: <20081014175040.GA55591@icarus.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <59f4cb420810140943r113f1494la477606c004833ca@mail.gmail.com> <20081014175040.GA55591@icarus.home.lan> Cc: freebsd-questions@freebsd.org Subject: Re: mktime() output not the same as the date utility X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 18:46:24 -0000 On Tue, Oct 14, 2008 at 1:50 PM, Jeremy Chadwick wrote: > On Tue, Oct 14, 2008 at 12:43:54PM -0400, Mark B. wrote: >> I can't figure out from the man pages why >> mktime() is giving a different result than date -f. >> Both strptime and mktime are supposed to use the >> local timezone, as does date. >> >> The output of date is correct; mktime() is an hour later. >> >> What am I missing here? > > I'm betting it's due to DST > Yes, set tm_isdst to -1 before calling mktime() and then my test program works as expected. Thanks, m