check the time and date

2003-08-27 Thread Boon Chong Ang
Hi,

Can anyone help me to solve the following task.

I want to ask perl to launch certain software and normally, we use system command, 
right? That is what I know. Now, due to license constraint, I can't use it at will. 
For instance, I can negotiate with my colleague to ask him/her to release the license 
within certain time and date and I want evoke the software through perl. How do it ask 
perl to check the time and date and in the following manager

 

Task:

check the time and date, for example when current time and date is 11am sharp, 27 
August and I want it to check license just say at 5:30pm 27August onwards and for 
example, when it failed to do so within 1 hours, 6.30pm 27 August, send an email to 
notify me to take necessary action or when it start to launch successfully and the 
process end, send email to notify me as well. In such manner, I don't have to come 
back to office purposely after office hour while I will be informed about the status 
of my task in general.

 

Can something guide me how to do this? For license checking, at this moment I don't 
have any clue but most probably I will use lmstat -a -c  li_check and use perl to 
manipulate the li_check file or some one can show me better solution hints. The 
working environment is sun solaris 8

 

Thank you  best regards,

ABC

 



What perl module converts unix time to regular time and date

2002-08-26 Thread FLAHERTY, JIM-CONT

What perl module converts unix time to regular time and date ?
 
Thanks 
Jim



Re: What perl module converts unix time to regular time and date

2002-08-26 Thread Felix Geerinckx

on Mon, 26 Aug 2002 12:43:17 GMT, [EMAIL PROTECTED] (Jim-Cont 
Flaherty) wrote:

 What perl module converts unix time to regular time and date ?

If you mean with 'unix time' seconds since epoch, and with 'regular 
time' year, month, day, hour, min and sec, you don't need a module.

See 

perldoc -f localtime
perldoc -f gmtime

for these built-in functions.

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: What perl module converts unix time to regular time and date

2002-08-26 Thread drieux


On Monday, August 26, 2002, at 05:43 , FLAHERTY, JIM-CONT wrote:

 What perl module converts unix time to regular time and date ?

 Thanks
 Jim

perldoc -f localtime

vladimir: 76:] perl -e 'my @stuff=localtime ; print @stuff\n;'
17 52 8 26 7 102 1 237 1
vladimir: 77:]perl -e '$thing=localtime ; print $thing\n;'
Mon Aug 26 08:52:52 2002
vladimir: 79:]

or were you interestin in more of the

perldoc Time::Local

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: time and date

2002-08-20 Thread David Zhuo

do you want to extract the date and time string in your email
message(header) or that you want to know what time does the email arrive?

david

A Taylor [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am trying to get the time and date that some one sends me an email.
 can anyone help me or point me in the right direction as how to get these
in
 perl ???

 Thanks in advance for your help - its much appreciated
 Anadi



 You are just a dewdrop, and as you meditate the dewdrop starts slipping
from
 the petals of the Lotus towards the ocean. When the meditation is
complete,
 the dewdrop has disappeared into the ocean. Or you can say, the ocean has
 disappeared into the dewdrop.

 Bhagwan Shree Rajneesh.


 _
 Join the world's largest e-mail service with MSN Hotmail.
 http://www.hotmail.com




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Time and Date

2002-08-20 Thread David Zhuo

$hour = 1;
$hour = sprintf(%02d,$hour); // $hour now become 01
$hour = 10;
$hour = sprintf(%02d,$hour); // $hour still 10

no need for the checking it's length.

david

A Taylor [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all,
 Thanks for your help so far - I have managed to sort out my time and date
 problem but there are a few points that I dont understand.
 The code I have used is as follows:

 # get the hours, mins, weekday, day, month  and year
 $hour  = (gmtime)[2];
 $min   = (gmtime)[1];
 $wday  = (qw(Sun Mon Tue Wed Thu Fri Sat)) [(gmtime) [6]];
 $day   = (gmtime)[3];
 $month = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)) [(gmtime)
 [4]];
 $year  = (gmtime)[5] + 1900;

 # test the length of $min - if length = 1 then add a '0' at the begining.

 $minlen = length $min;
 if ($minlen  2)
 {
 $min = 0.$min;
 }
 $hour ++;

 I have had to do a test to see if the $min var is 1 or 2 in length:

 $minlen = length $min;
 if ($minlen  2)
 {
 $min = 0.$min;
 }

 this is because 22:07 (for example) would otherwise come out as 22:7 -
which
 is a bit confusing. Is there a better way to do this 

 Also I have had to add 1 to the hour var: $hour ++; even though my web
space
 providers are in the same country as me - does anyone know why this is - I
 am probably being a bit daft - well it is 1am, and I have been perling for
 about 16 hours now !!! Gulp ^_^

 Thanks for any help
 Anadi


 You are just a dewdrop, and as you meditate the dewdrop starts slipping
from
 the petals of the Lotus towards the ocean. When the meditation is
complete,
 the dewdrop has disappeared into the ocean. Or you can say, the ocean has
 disappeared into the dewdrop.

 Bhagwan Shree Rajneesh.


 _
 MSN Photos is the easiest way to share and print your photos:
 http://photos.msn.com/support/worldwide.aspx




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Time and Date

2002-08-20 Thread david zhuo

You should be aware that your have multiple gmtime() function calls in your 
script and this could cause problem. the reason is because between your 
first and second gmtime() function call, some times have passed(yes, very 
very very little but...) so the time return by the 2 gmtime() functions 
call is NOT identical. So it's possible that if  you run the script in 
midnight, the next gmtime() might return the time for the next day! what 
you want is have one gmtime() function call and capture the result like:

($min,$hour,$day,$month,$year,$wday) = (gmtime)[1..6];

and then work on the individaul part...

david

A Taylor wrote:

 Hi all,
 Thanks for your help so far - I have managed to sort out my time and date
 problem but there are a few points that I dont understand.
 The code I have used is as follows:
 
 # get the hours, mins, weekday, day, month  and year
 $hour  = (gmtime)[2];
 $min   = (gmtime)[1];
 $wday  = (qw(Sun Mon Tue Wed Thu Fri Sat)) [(gmtime) [6]];
 $day   = (gmtime)[3];
 $month = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)) [(gmtime)
 [4]];
 $year  = (gmtime)[5] + 1900;
 
 # test the length of $min - if length = 1 then add a '0' at the begining.
 
 $minlen = length $min;
 if ($minlen  2)
 {
 $min = 0.$min;
 }
 $hour ++;
 
 I have had to do a test to see if the $min var is 1 or 2 in length:
 
 $minlen = length $min;
 if ($minlen  2)
 {
 $min = 0.$min;
 }
 
 this is because 22:07 (for example) would otherwise come out as 22:7 -
 which is a bit confusing. Is there a better way to do this 
 
 Also I have had to add 1 to the hour var: $hour ++; even though my web
 space providers are in the same country as me - does anyone know why this
 is - I am probably being a bit daft - well it is 1am, and I have been
 perling for about 16 hours now !!! Gulp ^_^
 
 Thanks for any help
 Anadi
 
 
 You are just a dewdrop, and as you meditate the dewdrop starts slipping
 from the petals of the Lotus towards the ocean. When the meditation is
 complete, the dewdrop has disappeared into the ocean. Or you can say, the
 ocean has disappeared into the dewdrop.
 
 Bhagwan Shree Rajneesh.
 
 
 _
 MSN Photos is the easiest way to share and print your photos:
 http://photos.msn.com/support/worldwide.aspx


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




time and date

2002-08-19 Thread A Taylor

I am trying to get the time and date that some one sends me an email.
can anyone help me or point me in the right direction as how to get these in 
perl ???

Thanks in advance for your help - its much appreciated
Anadi



You are just a dewdrop, and as you meditate the dewdrop starts slipping from 
the petals of the Lotus towards the ocean. When the meditation is complete, 
the dewdrop has disappeared into the ocean. Or you can say, the ocean has 
disappeared into the dewdrop.

Bhagwan Shree Rajneesh.


_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: time and date

2002-08-19 Thread Kevin Meltzer

Hi Anadi,

You want to take a look at the MIME-tools, specifically MIME::Parser
and MIME::Head (look for MIME::Tools on http://search.cpan.org). If
that seems too heavy duty for your needs, take a look at the Mail::*
modules on the CPAN. 

Also look there for ways to access the mail, if you haven't gotten that
far yet (Mail::POP3Client, Mail::IMAPClient, etc...).

Of course, you are then going to want to muck about with the actual
time you get, since it may not be in your timezone :)

Cheers,
Kevin

On Mon, Aug 19, 2002 at 09:34:08PM +, A Taylor ([EMAIL PROTECTED]) said 
something similar to:
 I am trying to get the time and date that some one sends me an email.
 can anyone help me or point me in the right direction as how to get these in 
 perl ???
 
 Thanks in advance for your help - its much appreciated
 Anadi
 
 
 
 You are just a dewdrop, and as you meditate the dewdrop starts slipping from 
 the petals of the Lotus towards the ocean. When the meditation is complete, 
 the dewdrop has disappeared into the ocean. Or you can say, the ocean has 
 disappeared into the dewdrop.
 
 Bhagwan Shree Rajneesh.
 
 
 _
 Join the world’s largest e-mail service with MSN Hotmail. 
 http://www.hotmail.com
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
This Too Shall Pass
-- inscription on the inside of King Solomon's Ring.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Time and Date

2002-08-19 Thread A Taylor

Hi all,
Thanks for your help so far - I have managed to sort out my time and date 
problem but there are a few points that I dont understand.
The code I have used is as follows:

# get the hours, mins, weekday, day, month  and year
$hour  = (gmtime)[2];
$min   = (gmtime)[1];
$wday  = (qw(Sun Mon Tue Wed Thu Fri Sat)) [(gmtime) [6]];
$day   = (gmtime)[3];
$month = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)) [(gmtime) 
[4]];
$year  = (gmtime)[5] + 1900;

# test the length of $min - if length = 1 then add a '0' at the begining.

$minlen = length $min;
if ($minlen  2)
{
$min = 0.$min;
}
$hour ++;

I have had to do a test to see if the $min var is 1 or 2 in length:

$minlen = length $min;
if ($minlen  2)
{
$min = 0.$min;
}

this is because 22:07 (for example) would otherwise come out as 22:7 - which 
is a bit confusing. Is there a better way to do this 

Also I have had to add 1 to the hour var: $hour ++; even though my web space 
providers are in the same country as me - does anyone know why this is - I 
am probably being a bit daft - well it is 1am, and I have been perling for 
about 16 hours now !!! Gulp ^_^

Thanks for any help
Anadi


You are just a dewdrop, and as you meditate the dewdrop starts slipping from 
the petals of the Lotus towards the ocean. When the meditation is complete, 
the dewdrop has disappeared into the ocean. Or you can say, the ocean has 
disappeared into the dewdrop.

Bhagwan Shree Rajneesh.


_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Time and Date

2002-08-19 Thread John W. Krahn

A Taylor wrote:
 
 Hi all,

Hello,

 Thanks for your help so far - I have managed to sort out my time and date
 problem but there are a few points that I dont understand.
 The code I have used is as follows:
 
 # get the hours, mins, weekday, day, month  and year
 $hour  = (gmtime)[2];
 $min   = (gmtime)[1];
 $wday  = (qw(Sun Mon Tue Wed Thu Fri Sat)) [(gmtime) [6]];
 $day   = (gmtime)[3];
 $month = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)) [(gmtime)
 [4]];
 $year  = (gmtime)[5] + 1900;
 
 # test the length of $min - if length = 1 then add a '0' at the begining.
 
 $minlen = length $min;
 if ($minlen  2)
 {
 $min = 0.$min;
 }
 $hour ++;
 
 I have had to do a test to see if the $min var is 1 or 2 in length:
 
 $minlen = length $min;
 if ($minlen  2)
 {
 $min = 0.$min;
 }
 
 this is because 22:07 (for example) would otherwise come out as 22:7 - which
 is a bit confusing. Is there a better way to do this 

Yes, use sprintf.

my $hour  = sprintf '%02d', (gmtime)[2];
my $min   = sprintf '%02d', (gmtime)[1];
etc...


 Also I have had to add 1 to the hour var: $hour ++; even though my web space
 providers are in the same country as me - does anyone know why this is - I
 am probably being a bit daft - well it is 1am, and I have been perling for
 about 16 hours now !!! Gulp ^_^

They are probably using a different time zone then you.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Time and Date

2002-08-19 Thread Elaine -HFB- Ashton

A Taylor [[EMAIL PROTECTED]] quoth:
*
*Also I have had to add 1 to the hour var: $hour ++; even though my web 
*space providers are in the same country as me - does anyone know why this 
*is - I am probably being a bit daft - well it is 1am, and I have been 
*perling for about 16 hours now !!! Gulp ^_^

As far as I know, gmtime() returns hours in the range of 0..23 :)

You might want to check out the core module Time::Local too.

e.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Time and date formats

2002-03-01 Thread Troy May

What do the letters after the %02 mean?  I know about %02d, but I came
across a few scripts with %02u in it.  I've never seen that, what does it
mean?  What's the difference between the d and the u?  And what ELSE can
you possibly use there?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Time and date formats

2002-03-01 Thread Timothy Johnson

 
Check the documentation on sprintf().  I don't have perl with me, but I
think perldoc -f sprintf will find it, otherwise you can look through the
perlfunc section of the docs for sprintf.  Offhand I'd guess that %02u
refers to an unsigned integer in decimal format?

-Original Message-
From: Troy May
To: Perl Beginners
Sent: 3/1/02 5:50 PM
Subject: Time and date formats

What do the letters after the %02 mean?  I know about %02d, but I
came
across a few scripts with %02u in it.  I've never seen that, what does
it
mean?  What's the difference between the d and the u?  And what ELSE
can
you possibly use there?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Time and date formats

2002-03-01 Thread Brett W. McCoy

On Fri, 1 Mar 2002, Troy May wrote:

 What do the letters after the %02 mean?  I know about %02d, but I came
 across a few scripts with %02u in it.  I've never seen that, what does it
 mean?  What's the difference between the d and the u?  And what ELSE can
 you possibly use there?

I can only assume you mean in a sprintf format string (you should specify
such things so people know what you are talking about).  The 'u' means
'unsigned integer'.

Take a look at the sprintf documentation:

perldoc -f sprintf

-- Brett
  http://www.chapelperilous.net/

Don't read everything you believe.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]