• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting time components of date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting time components of date


  • Subject: Re: Getting time components of date
  • From: Graff <email@hidden>
  • Date: Wed, 24 Dec 2003 12:19:18 -0500

I was just responding with a bit of humor at the speed difference between Arthur's code and my code. He had said that his code executes in 0.0024 seconds verses 0.01 seconds for mine, really a trivial difference unless you are doing the formatting many times in a tight loop. I jabbed back a about code size just to stick out my tongue at him. His code was interesting and did the job well, even if it was a bit like using a sledgehammer to kill a fly. It is a very good general-use date formatting script.

As for compiling my C code on the command line, do you have Apple's Developer tools installed? I'm not sure if it is installed through the Developer tools or through the BSD stuff, I usually just install everything but the extra language support.

If so then maybe your symbolic link from cc to gcc is broken, try the tool /usr/bin/gcc to compile the code if you wish. The command cc is a symbolic link to your C compiler, usually gcc. In Panther the command /usr/bin/cc is a link to /usr/bin/gcc-3.3.

Anyways, it is not needed because the code I provided is pretty much the same thing as the date tool, just with the formatting built-in. I'd just use the date tool instead, the C code was just me fooling around.

- Ken

On Dec 24, 2003, at 5:25 AM, Nigel Garvey wrote:

Graff wrote on Tue, 23 Dec 2003 04:51:49 -0500:

I have no doubt that Arthur's script is quick but sometimes you need to
balance speed verses complexity. The best balance of speed and
complexity is probably the command-line tool "date" even though it is
0.0076 seconds slower than Arthur's code.

It can also only handle the current system date and can only be used in
Mac OS X. Arthur's code, besides being faster, can handle any date thrown
at it and works on any system since the invention of AppleScript. The
balance is actually script performance versus the scripter's personal
convenience. (I'm not, of course, suggesting that any particular method
*must* be used. I'm just trying to clarify the logic.)

I mean, to use the date tool
you need 1 line of code as opposed to 123 for Arthur's code, even with
the comments and extra blank lines taken out of it!

You don't need to type them out every time. AppleScript allows for the
loading of libraries. With Arthur's handler in a library, you only need
one line to use it too.

Anyways, if this function really needs to be any faster than 0.01
seconds then AppleScript is the wrong tool to be using for this
purpose.

If you're writing an AppleScript in which the need for a date and time
string arises, then AppleScript's the tool you're using. The greater
speed and flexibility of its vanilla solutions is a bonus. :-)


I can't get your "won't get faster than this" process to work. Terminal
complains: "cc: Command not found." when I try to compile the text file.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Getting time components of date
      • From: Christopher Stone <email@hidden>
References: 
 >Re: Getting time components of date (From: Nigel Garvey <email@hidden>)

  • Prev by Date: [ANN] XBurn 1.0
  • Next by Date: Re: New AppleScript book
  • Previous by thread: Re: Getting time components of date
  • Next by thread: Re: Getting time components of date
  • Index(es):
    • Date
    • Thread