Date changed callback

T

twister

Hi,
Is there a possibility to register some method of an user-defined
object to keep it notified about the date changed event? I wonder if
there is a non os-related solution.
My object will process some request and they should be grouped by the
date. I can get the current date for each request and activate a
proper group, but it would be more effectively if the date was updated
once per 24h not for every request. Additionaly if the group is older
than some period it should be removed.
Thanks in advance,
twister
 
V

Victor Bazarov

twister said:
Is there a possibility to register some method of an user-defined
object to keep it notified about the date changed event? I wonder if
there is a non os-related solution.

There can be no "non os-related solution" since calendar, time, date are
all concepts that are platform-specific, and aren't guaranteed to exist.

V
 
T

twister

twister said:
Is there a possibility to register some method of an user-defined
object to keep it notified about the date changed event? I wonder if
there is a non os-related solution.

There can be no "non os-related solution" since calendar, time, date are
all concepts that are platform-specific, and aren't guaranteed to exist.

V

But if the linux/unix system is considered where it could be
registered?

Thanks,
twister
 
J

Jorgen Grahn

Hi,
Is there a possibility to register some method of an user-defined
object to keep it notified about the date changed event? I wonder if
there is a non os-related solution.
My object will process some request and they should be grouped by the
date. I can get the current date for each request and activate a
proper group, but it would be more effectively if the date was updated
^^^^^^^^^^^
Do you mean "more efficient" or "more elegant" or something else?
once per 24h not for every request. Additionaly if the group is older
than some period it should be removed.

You mentioned Unix later on. There is no such signal there -- and I
think there isn't in any modern OS. It's unimportant to almost all
software, and different processes can be in different timezones anyway.

Plus, I doubt it is wise to add asynchronous events to an application
which doesn't otherwise need it.

If you know that finding the date from a time_t will take too
much time (thousands of requests per second?) then you can write
a class that caches such knowledge. E.g. if time_t(N) is 08:00
today, then we're still at the same date at time_t(N+10), or
time_t(N+10000). Just watch out for DST changes -- check the real
date now and then. Once a minute, maybe.

/Jorgen
 
P

peter koch

                                     ^^^^^^^^^^^
Do you mean "more efficient" or "more elegant" or something else?


You mentioned Unix later on.  There is no such signal there -- and I
think there isn't in any modern OS. It's unimportant to almost all
software, and different processes can be in different timezones anyway.

On Unix you could send a signal that would by default be ignored.
Also, on Windows every process with a message queue will get a message
whenever there is a time "change" and in many other cases.
And there is software that cares. As an example all types of software
that is supposed to react on certain times of the day, and I do not
believe software of that type is so uncommon. Several types of
software I have developed has had such time dependencies, although
admittedly some of that has been running in the UTC timezone.
Plus, I doubt it is wise to add asynchronous events to an application
which doesn't otherwise need it.

Why?

/Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,138
Messages
2,570,801
Members
47,347
Latest member
RebekahStu

Latest Threads

Top