
I agree with @Ashok, scheduling the task using cron jobs at the operating system level seems like the most intuitive way to approach @Lawi's problem. On Windows or other non UNIX-like O.Ss, use the "Scheduled Tasks" application or something similar. If I was to go with @Adam's way but write the system in JAVA I would use annotations <http://en.wikipedia.org/wiki/Java_annotation> which are just the opposite numbers to Python's decorators. I would have written the code to illustrate my point, but laziness as you all know is a virtue to any programmer worth his / her salt :-) Martin. On Thu, May 2, 2013 at 11:02 AM, Peter Karunyu <pkarunyu@gmail.com> wrote:
@Lawi, whether you like it or not, time IS tied to a date, because time cannot exist in the absence of a date.
So if users can only login between 1800Hrs on the current day and 0600Hrs the next day, the day still exists, only that its *rolling.*
Does that make sense?
On Thu, May 2, 2013 at 10:51 AM, Francis Njenga <korefn@gmail.com> wrote:
@Adam not knowing the offending language, a concrete solution is as a pain so making sure he knows that specific fact('In the abstract') would have sufficed IMHO. [?]
On Thu, May 2, 2013 at 10:46 AM, Adam Nelson <adam@varud.com> wrote:
@francis I think he's using the word 'timestamp' loosely as the time of day. But yes, as everyone agrees so far, just use the timestamp which has all the date information and then comparison is trivial.
Since we all seem to be having fun wasting time on a Thursday, I did it in Python for demonstration purposes. I set 'a' to now and then 'b' to now a few seconds later and then arbitrarily set 'c' to a time within the period. This is date-sensitive.
---------------- ➜ ~ python Python 2.7.3 (default, Dec 5 2012, 11:30:37) [GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin Type "help", "copyright", "credits" or "license" for more information.
import datetime a = datetime.datetime.now() a datetime.datetime(2013, 5, 2, 10, 42, 36, 877059) b = datetime.datetime.now() b datetime.datetime(2013, 5, 2, 10, 42, 50, 684714) c = datetime.datetime(2013, 5, 2, 10, 42, 49, 000000) c datetime.datetime(2013, 5, 2, 10, 42, 49) bool(a <= b < c) False bool(a <= c < b) True
https://twitter.com/varud https://www.linkedin.com/in/adamcnelson
On Thu, May 2, 2013 at 9:37 AM, Francis Njenga <korefn@gmail.com> wrote:
A timestamp will have all these details and you can extract the relevant details from it. I.e. datetime has both date and time. You can use the time or date where relevant. This is the essence of a timestamp.
On Thu, May 2, 2013 at 10:31 AM, Peter Karunyu <pkarunyu@gmail.com>wrote:
@Lawi, does the start times change per day or are they sorta fixed at a preset time?
Say, every day at 0600Hrs is the start, and every day at 1800Hrs is the end
_______________________________________________ skunkworks mailing list skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Kore Francis Njenga Running and Walking are only breaths apart.
_______________________________________________ skunkworks mailing list skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
_______________________________________________ skunkworks mailing list skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Kore Francis Njenga Running and Walking are only breaths apart.
_______________________________________________ skunkworks mailing list skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Regards, Peter Karunyu -------------------
_______________________________________________ skunkworks mailing list skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke