This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New log file header


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 02 Mar 2004 23:38:52 -0500, Harold L Hunt II <huntharo@msu.edu> wrote:
>
> The new header in the log file, as of XFree86-xserv-4.3.0-49, looks like
> the following:
>
> ===================================================
> Welcome to the XWin X Server
> Vendor: The Cygwin/X Project
> Release: 4.3.0.49
> Contact: cygwin-xfree at cygwin daught com
>
> XWin was started with the following command line:
>
> XWin :0 -multiwindow -clipboard
>
> ddxProcessArgument - Initializing default screens
> [...]
> ===================================================

This change is very good, but there are 2 notes:

1. The Identification (Welcome ... Contact) appears twice (at the top
   and just after "winInitializeDefaultScreens".

2. Could you add a time-stamp at beginning of each line ?
   I tried to correspond the log messages with external actions (i.e.
   copy/paste and Emacs errors) and the time stamp could help.

   I use the code below in my programs.

BTW. I could not download 4.3.0-50 from the mirrors yet.

Ehud.


#include <stdio.h>
#include <time.h>                          /* for day / hour check */

void  write_date_time ( FILE *fl ) ;       /* write date & time in "dd/mm/yy HH:MM:SS " */
void  write_date ( FILE *fl ) ;            /* write date in "dd/mm:yy " */
void  write_time ( FILE *fl ) ;            /* write time in "HH:MM:SS " */

static int get_ofst ( void ) ;             /* compute offset from GMT */


static int  sec_ofst = 1 ;                 /* seconds offset from Greenwich M. T. */
static int  saved_day = 999999 ;           /* initial high value */
static char p_date [ 10 ] ;                /* edited date - dd:mm:yy */


void  write_date_time ( FILE *fl )         /* write date & time in "dd/mm/yy HH:MM:SS " */
{
   write_date ( fl ) ;                     /* write date */
   write_time ( fl ) ;                     /* write time */
}
/*===========================================================================*/

void  write_date ( FILE *fl )              /* write date in "dd/mm:yy " */
{
   if ( sec_ofst == 1 )
       sec_ofst = get_ofst ( ) ;           /* get offset (1 time only) */
   fprintf ( fl , "%s " , p_date ) ;       /* dd:mm:yy_ format */
}
/*===========================================================================*/

void  write_time ( FILE *fl )              /* write time in " HH:MM:SS " */
{
int  sec, min, hr;
time_t tloc ;                              /* seconds from 1/1/1970 0.0.0 GMT */

       if ( sec_ofst == 1 )
           sec_ofst = get_ofst ( ) ;       /* get offset (1 time only) */
       time (& tloc) ;                     /* get gmt seconds from 1/1/1970 */
       tloc += sec_ofst ;                  /* seconds - local time */
       sec = tloc % 60 ;                   /* seconds = time MOD 60 */
       tloc /= 60 ;                        /* convert to minutes */
       min = tloc % 60 ;                   /* minuets = (time/60) MOD 60 */
       tloc /= 60 ;                        /* convert to hours */
       hr = tloc % 24 ;                    /* hours = (time/3600) MOD 24 */
       tloc /= 24 ;                        /* days (local time) */
       if ( tloc > saved_day )             /* day change ? */
           sec_ofst = 1 ;                  /* re-compute date next time */
       saved_day = tloc ;                  /* save days (local time) */
       fprintf ( fl , "%02d:%02d:%02d ",hr,min,sec) ;   /* _hh:mm:ss_ format */
}
/*===========================================================================*/

static int get_ofst ( void )               /* compute offset from GMT */
{
#define FDAY 86400                         /* full day in seconds 24*60*60 */
#define HDAY 43200                         /* half day in seconds */
struct tm ofst;
time_t tloc ;                              /* seconds from 1/1/1970 0.0.0 GMT */
int sec_ofst ;

   time (& tloc) ;                         /* get current time */
   ofst = *gmtime (& tloc) ;               /* find GMT hour */
   sec_ofst = ( ofst.tm_hour * 60 +
                ofst.tm_min ) * 60 +
                ofst.tm_sec ;              /* GMT hour (in seconds) */
   ofst = *localtime (& tloc) ;            /* find local hour */
   sec_ofst = ( ( ofst.tm_hour * 60 +
                  ofst.tm_min ) * 60 +
                  ofst.tm_sec - sec_ofst
                + FDAY ) % FDAY ;          /* Local - GMT hours (in seconds, 0-FDAY) */
   if ( sec_ofst > HDAY )
       sec_ofst -= FDAY ;                  /* sec_ofst in range -11:59:59 +12:00:00 */
   sprintf ( p_date , "%02d/%02d/%02d" ,   /* save date */
             ofst.tm_mday ,
             ( ofst.tm_mon + 1 ) ,
             ( ofst.tm_year % 100 ) ) ;
   return ( sec_ofst ) ;
}
/*============================================================================*/


- --
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D <http://www.keyserver.net/>    Better Safe Than Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQFARe4XLFvTvpjqOY0RAigvAJ42LvdLtYvLuEPlpzSr/+8gDzLWgwCeL9Qc
70+hosDCLGOE15RhGLgaqCk=
=9Nsy
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]