From owner-freebsd-hackers Sat Apr 10 20:48:39 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from hydrogen.fircrest.net (metriclient-3.uoregon.edu [128.223.172.3]) by hub.freebsd.org (Postfix) with ESMTP id 6634114BFC for ; Sat, 10 Apr 1999 20:48:32 -0700 (PDT) (envelope-from gurney_j@efn.org) Received: (from jmg@localhost) by hydrogen.fircrest.net (8.9.1/8.8.7) id UAA08197; Sat, 10 Apr 1999 20:46:20 -0700 (PDT) Message-ID: <19990410204620.48742@hydrogen.nike.efn.org> Date: Sat, 10 Apr 1999 20:46:20 -0700 From: John-Mark Gurney To: freebsd-hackers@freebsd.org Subject: date as userland strptime Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.69 Reply-To: John-Mark Gurney Organization: Cu Networking X-Operating-System: FreeBSD 3.0-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG currently date cannot be used as a userland interface to strptime when using the -f flag as it always trys to set the date with the -f flag, and aborts if you are not root. I quickly hacked date to have an option (I used -j for some reason, this can be changed) that would have date not set the date... this allows you to run: date -j -f "%a, %d %b %Y %H:%M:%S %Z" "" +%s to get the number of seconds of time... this works great except the fact that strptime (on 3.0-R or 3.1-R) ignores %Z and blindly assumes the time is in the local timezone... I haven't looked into fixing this problem yet... so, would people be interested in seeing this change in the tree? or any objections to adding the option? (I also made the nflag an option instead of it being a global variable) -- John-Mark Gurney Voice: +1 541 684 8449 Cu Networking P.O. Box 5693, 97405 Live in Peace, destroy Micro$oft, support free software, run FreeBSD Don't trust anyone you don't have the source for To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message