[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Setting Mac date and time



At 3:37 pm +0100 3/3/98, Ben Ko wrote:
>date and time? I thought before I start trying to understand Apple Events
>directly (with help fromMacPerl:Power and Ease and Chris Nandor's TPJ
>article) I should confirm that i'm not making this much harder than it
>actually is.
[snip]

Nothing wrong with time and localtime... portable too!
-----
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
	= localtime(time);

# COZ IT STARTS AT INDEX ZERO FOR EASY ARRAY ACCESS
$mon++;

# COZ YEARS START AT 1900
# (AND CAN WE *PLEASE* AVOID THE Y2K DISCUSSION AGAIN :-)
$year += 1900;

printf("The time is %02d:%02d:%02d\n", $hour, $min, $sec);

print (<<EOT);
It's day $wday of the week (Sunday is day 0),
and day $mday of month $mon of the year $year
EOT

print "Daylight savings are in full effect" if $isdst;
-----

To completely change the subject. I've got a little script for info-mac
downloads (tries your Internet Config preferred sites, then others if it
cannot be found there. Keeps track of previously failed downloads and trys
again the next time you run it, and other stuff...)

As was thinking of tidying up the code and added a Mac front end.... would
people be interested?

Anyway... back to real work...

Cheers,

Adrian

----
Adrian Howard. adrianh@victoriareal.co.uk. Head Techie. Victoria Real Ltd
URL: http://www.victoriareal.co.uk/ v. +44 1273 774469 f. +44 1273 779960



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch