Re: Panel clock applet goes blank after midnight



I had a similar problem with a little program I wrote for windows in
Visual Basic.  I'd use the system timer to time how long someone had been
on, but it too failed after midnight.  I realized what was happening was
that I was subtracting the current time (measured in seconds past
midnight) from the program start time (in seconds past midnight).  When
midnight rolled around, the current time would be lower than the start
time, yielding a negative running time, crashing the program.  I haven't
looked at the source for GTK, and even if I did I couldn't tell you
anything, but a similar problem might be happening here.  The solution is
pretty simple:

elapsed time = ((current time - system time) + 86400) MOD 86400

This ensures that elapsed time is > 0

/-------------------------------------------------\
|                  Soren Harward                  |
|Assistant Sysadmin/Tech Support - Cinternet, Inc.|
|   Voice: 891-1228         soren@cinternet.net   |
|-------------------------------------------------|
|Windows 95/98 DOES come with a tool that lets you|
|rebuild a corrupted Registry.  It's called FDISK.|
\-------------------------------------------------/

On Thu, 21 May 1998, Miguel de Icaza wrote:

> 
> > Bug report: The clock applet goes blank after midnight. Moving it around
> > will show the normal stuff again, but after midnight (i.e. when the date
> > changes) it goes blank. I do a lot of "staying up after midnight", so I've
> > noticed repeatedly.
> 
> I took a look at the code and I can not figure out what is wrong.
> 
> I can only think of Gtk timeout routines failing after midnight.
> 
> Miguel.
> 
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]