CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Problems in dates and time additions by one minute.

 



survivor
New User

Dec 18, 2011, 11:12 AM

Post #1 of 3 (2324 views)
Problems in dates and time additions by one minute. Can't Post

Hi,

I have 3 files (these are the log files of the system). These files have date formate like this (Dec 5 09:02:01).
I need to read these files from from the first date(Dec 5 09:02:01) till the last date (Dec 17 17:34:02) in the file. Then i have to search a word between the time difference of one minute and i have to count that how many times that word is present between these two time period.

For example :

Start time End Time Number of times word found
Dec 5 09:02:01 Dec 5 09:03:00 10 (First entry)
Dec 5 09:03:01 Dec 5 09:03:00 5 ( Second entry )
Dec 5 09:04:01 Dec 5 09:04:00 3 (third entry)


and so on till the last entry of the date (Dec 17 17:34:02)

How i can handle these dates. I have read about the Time::Local but that did not solve my problem.
I will be very thankful for any help.


BillKSmith
Veteran

Dec 18, 2011, 12:17 PM

Post #2 of 3 (2319 views)
Re: [survivor] Problems in dates and time additions by one minute. [In reply to] Can't Post

The module Date::Calc is the 'Swiss army knife' of date/time calculations. It is usually overkill, but it has never let me down.
Good Luck,
Bill


rovf
Veteran

Dec 21, 2011, 4:37 AM

Post #3 of 3 (2235 views)
Re: [survivor] Problems in dates and time additions by one minute. [In reply to] Can't Post

While Bills reply is absolutely correct, I wonder why you can't do it with Time::Local. This module seems to be perfectly suitable for this task too.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives