Date changed callback

  • Follow


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
0
Reply dariusz.boczkowski (13) 11/16/2009 4:27:23 PM

twister wrote:
> 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
-- 
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
0
Reply Victor 11/16/2009 4:36:59 PM


On 16 Lis, 17:36, Victor Bazarov <v.Abaza...@comAcast.net> wrote:
> twister wrote:
> > 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
> --
> Please remove capital 'A's when replying by e-mail
> I do not respond to top-posted replies, please don't ask

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

Thanks,
twister
0
Reply twister 11/16/2009 4:48:30 PM

On Nov 16, 8:48=A0am, twister <dariusz.boczkow...@gmail.com> wrote:
> On 16 Lis, 17:36, Victor Bazarov <v.Abaza...@comAcast.net> wrote:
>
> > twister wrote:
> > > 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 ar=
e
> > all concepts that are platform-specific, and aren't guaranteed to exist=
..
>
> > > [..]
>
> > V
> > --
> > Please remove capital 'A's when replying by e-mail
> > I do not respond to top-posted replies, please don't ask
>
> But if the linux/unix system is considered where it could be
> registered?
>

Ask on comp.unix.programmer.  Any such mechanism would be platform
specific, and not topical to comp.lang.c++.


0
Reply red 11/16/2009 5:25:11 PM

On Mon, 2009-11-16, twister wrote:
> 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

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .  .
\X/     snipabacken.se>   O  o   .
0
Reply Jorgen 11/18/2009 6:44:23 PM

On 18 Nov., 19:44, Jorgen Grahn <grahn+n...@snipabacken.se> wrote:
> On Mon, 2009-11-16, twister wrote:
> > 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
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0^^^^^^^^^^^
> 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. =A0There 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
0
Reply peter 11/18/2009 8:52:20 PM

5 Replies
112 Views

(page loaded in 0.153 seconds)

Similiar Articles:













7/21/2012 7:48:10 PM


Reply: