Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Apr 1999 20:46:20 -0700
From:      John-Mark Gurney <gurney_j@efn.org>
To:        freebsd-hackers@freebsd.org
Subject:   date as userland strptime
Message-ID:  <19990410204620.48742@hydrogen.nike.efn.org>

next in thread | raw e-mail | index | archive | help
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" "<date>" +%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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990410204620.48742>