×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Problems in dates and time additions

Problems in dates and time additions

Problems in dates and time additions

(OP)
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        EndTime                   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.

RE: Problems in dates and time additions

Time::Local is the way to go. With  timelocal()  you get a  time  value that you can easily manipulate, test for time periods, etc.
timelocal()  must be supplied with a list of time quantities that you can extract from your dates with   split, except for the year, that I assume is known from elsewhere. Month 3 letter names can be transformed into a number by creating a hash:
%months=('Jan',0,'Feb',1,...);
(be careful as this is case sensitive).
However you didn't tell us of what you've done so far.     

Franco
http://www.xcalcs.com : Online engineering calculations
http://www.megamag.it : Magnetic brakes for fun rides
http://www.levitans.com : Air bearing pads

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close