MACSCRPT Archives

September 2009

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Tue, 22 Sep 2009 16:06:33 -0400
Reply-To:
Macintosh Scripting Systems <[log in to unmask]>
Subject:
MIME-Version:
1.0
Content-Transfer-Encoding:
quoted-printable
In-Reply-To:
Content-Type:
text/plain; charset=UTF-8
From:
"Mark J. Reed" <[log in to unmask]>
Parts/Attachments:
text/plain (20 lines)
On Tue, Sep 22, 2009 at 3:40 PM, Mark Lively <[log in to unmask]> wrote:
> set time_offset to do shell script "date -j 081011001992 +%s"
> do shell script "date -j -v-" & time_offset & "S +%s.html"
>
> Might even be faster.

Especially if you just hard-code the date_offset value rather than
shelling out to date to calculate it every time.  (But note that it
isn't necessarily 713458800; it depends on the time zone in question.)

At the price of letting the shell do some more work and date(1) do
less, which will slow things down but probably not noticeably, you get
something which is arguably a bit clearer about what's going on:

set file_name to ( do shell script  ¬
    "echo $(( $(date +%s) - " & date_offset & "))" ) & ".html"

-- 
Mark J. Reed <[log in to unmask]>

ATOM RSS1 RSS2