473,385 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

checking if hour is between two hours

Hi all, i'm again working on my script of parsing logfiles :)
I putted a new function to disable the rule of error between a certain
hours, cause i want to use it as a monitoring script that run every 5
minutes and to disable error in hours of maintenance.
But i have some "problems" to check it.
In the rule-file i have HHMM(start) and HHMM(stop) ----- 0 0 to
disable hours check (i can't check the timestamp in logfile cause not
all the logfiles that i need to check have a timestamp in it).
In the script i wrote:

Actualtime=datetime.datetime.today().strftime("%H% M")
if (start>end):
if (Actualtime>start):
end=int(Hcheck)+1
else:
if (int(Actualtime)<int(end)):
start=Actualtime
if ((int(Actualtime)<int(start)) or (int(Actualtime)>int(end)) or
((start=="0") and (end=="0")) ):
rule=error
...blablabla....
else:
rule=skip
....blablabla....
Why i don't use the complete date with YYMMDDHHMM?
Think about a rule that need to be disabled from hours 20:00 to
04:00.
If i use also yymmdd, in the rule file i need to write a 2000 and
0400+1, the +1 to tell the script that the end
is in the day after, to add a day. But it will work just till the
0000, hour in witch the day will change.

The script work, but is not so "clean"....i just would like some
advice to make it more clean, if possible.

Like always, thanks in advance for the helps :)

May 11 '07 #1
0 1136

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Herb Kauhry | last post by:
I've been scratching my head on this for quite awhile and it has me stumped. I hope to define a query which I can use to fill a "day planner" type of calendar. Although I've see a lot of these,...
3
by: Jamie Pittman via AccessMonster.com | last post by:
I am currently working on a project to take an employees time for a day and and if over 8 hours it would move those extra hours to overtime row amd not caculate into regular time. I started to use...
5
by: marty | last post by:
As part of an assignment I need to calculate a 24 hour time by subtracting a one time from another e.g. if the user enters 1.00 as the time and 1.30 as the time to subtract the returned time is...
2
by: mtech1 | last post by:
Access 2003 I need to create a query to view data by 3 - 24 hour shifts. Ex: There are 3 shifts, each shift is 24 hours starting at 0700 through 0700. Each shift is designated as A, B, or C. ...
3
by: Pieter Coucke | last post by:
Hi, For some reason, somewhere in my application 1 hour is added to my dates, depending in which time zone the application is run... Because I don't have a clue where this happens, I posted this...
3
by: Shawn Yates | last post by:
I have a database that I am using as a Time clock where employees can clock in and out. Is there a way to make it so that when they clock out a form would open displaying their work day hour by...
16
by: Claudio Grondi | last post by:
Sometimes it is known in advance, that the time spent in a loop will be in order of minutes or even hours, so it makes sense to optimize each element in the loop to make it run faster. One of...
1
by: George | last post by:
Hello........I have a problem adding up record entries with more than 24 hours when the fields are formatted as hour/minute (h:m). If the actual summed total of all records is greater than 24...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.