BB Unix Network Monitor - Message

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

Re: {bb} wrong history



Hi Robert!

My best times of programming are lying much time back. The last years I've
"just" been sysadmin for Solaris. So I do not remember very much. It was a
hard work yet to encounter the problem with bb and OpenBSD...
As it seems like the manpages it seems in OpenBSD the same as in FreeBSD.
Here is what the man pages say:

TIME(3)                   OpenBSD Programmer's Manual                 
TIME(3)

NAME
     time - get time of day

SYNOPSIS
     #include <time.h>

     time_t
     time(time_t *tloc);

DESCRIPTION
     The time() function returns the value of time in seconds since 0 hours,
0
     minutes, 0 seconds, January 1, 1970, Coordinated Universal Time (UTC).

     A copy of the time value may be saved to the area indicated by the
point-
     er tloc.  If tloc is a null pointer, no value is stored.

     Upon successful completion, time() returns the value of time. 
Otherwise
     a value of (time_t)-1 is returned and the global variable errno is set
to
     indicate the error.


Hope this helps you to understand a bit more...
As for now it seems that the "hack" with long for lasttime is working for
me...

Bye - and thanks...
Matthias

> Hi Matthias,
> 
> Nice find. The problem is definitely that but it'll have effect
> all over as time_t is used all over and that time_t should at
> least be a long...
> 
> Can you tell me what the prototypes for the time() function are ?
> 
> Under FreeBSD, it's defined this way:
> 
> 
> -------------------
> TIME(3)                FreeBSD Library Functions Manual 
> TIME(3)
> 
> NAME
>       time - get time of day
> 
> LIBRARY
>       Standard C Library (libc, -lc)
> 
> SYNOPSIS
>       #include <time.h>
> 
>       time_t
>       time(time_t *tloc);
> 
> DESCRIPTION
>       The time() function returns the value of time in seconds since 0 
> hours, 0
>       minutes, 0 seconds, January 1, 1970, Coordinated Universal Time.
> 
>       A copy of the time value may be saved to the area indicated by the
>       pointer tloc.  If tloc is a NULL pointer, no value is stored.
> 
> --------------------
> 
> As you can see, if time_t is defined as an int, time() will definitely
> return an incorrect value.
> 
> thanks
> 
> 
> 
> Matthias Schreiber wrote:
> 
> > Hi Henrik!
> > 
> > I found the Error in the Source Code which is responsible for the wrong
> > history file. In OpenBSD, at least in OpenBSD for Solaris64, the time_t
> is
> > not equal to long but just to int. So in bbd.c in line 1791 the fscanf
> > receives not the correct time for lasttime. I changed in bbd.c the
> > declaration from time_t lasttime; to long lasttime; and it seems to
> work...
> > Ok. Just had 1 hour test for now... erhaps now something else isn't
> > working... but the problem definitely is in the wrong declaration of the
> > time_t...
> > 
> > Here are the definitions of _BSD_TIME_T_ and time_t in OpenBSD...:
> > 
> > /usr/include/sparc64/ansi.h:#define     _BSD_TIME_T_            int     
>    
> >    /* time() */
> > /usr/include/sys/types.h:#ifdef _BSD_TIME_T_
> > /usr/include/sys/types.h:typedef        _BSD_TIME_T_    time_t;
> > /usr/include/sys/types.h:#undef _BSD_TIME_T_
> > /usr/include/time.h:#ifdef      _BSD_TIME_T_
> > /usr/include/time.h:typedef     _BSD_TIME_T_    time_t;
> > /usr/include/time.h:#undef      _BSD_TIME_T_
> > /usr/include/utime.h:#ifdef     _BSD_TIME_T_
> > /usr/include/utime.h:typedef    _BSD_TIME_T_    time_t;
> > /usr/include/utime.h:#undef     _BSD_TIME_T_
> > 
> > Hope anybody could evaluate those settings for the OpenBSD Sparc64
> > environment...
> > Thanks
> > 
> > Matthias
> > 
> > 
> >>In <20384.1101261312@www11.gmx.net> "Matthias Schreiber"
> >><compeiler@gmx.net> writes:
> >>
> >>
> >>>yet the logfiles themselves are wrong (in $BBHIST):
> >>>Sun Nov 21 23:03:51 2004 red   0 1101075474
> >>>Sun Nov 21 23:17:54 2004 green   0 1101077321
> >>>Sun Nov 21 23:48:41 2004 yellow   0 1101077873
> >>>Sun Nov 21 23:57:53 2004 green   0 1101081230
> >>>Mon Nov 22 00:53:50 2004 red   0 1101234176
> >>>Tue Nov 23 19:22:56 2004 green  1101234176
> >>
> >>How very strange !
> >>
> >>
> >>>and should be something like timestamp at position 7 and in position 8
> >>
> >>the
> >>
> >>>duration. If I calculate that by hand all looks fine...
> >>>Where is that routine which calculates an position 7 and 8???
> >>
> >>It's buried in the bb_log routine in bbd.c, around line 1850 or so in
> >>BB 1.9c (do a search for "TRYING TO OPEN HISTORY FILE").
> >>
> >>
> >>Henrik
> >>
> >>--
> >>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
> >>To unsubscribe from this list, or to subscribe to the bb-digest list
> >>send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
> >>subscribe bb-digest in the BODY of the message.
> >>
> > 
> > 
> 
> -- 
> Robert-Andre Croteau    BSD,MOTU
> Quest Software, Inc.            Big Brother, Product Architect
> http://www.quest.com/                          http://bb4.com/
> +1 (514) 238-9374
>          Si le bonheur ne s'achete pas alors louez le.
> 
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
> To unsubscribe from this list, or to subscribe to the bb-digest list
> send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
> subscribe bb-digest in the BODY of the message.
> 

-- 
Geschenkt: 3 Monate GMX ProMail + 3 Top-Spielfilme auf DVD
++ Jetzt kostenlos testen http://www.gmx.net/de/go/mail ++
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.


Home | Main Index | Thread Index