new problems with time.h

Damir Buskulic (buskulic@lapp.in2p3.fr)
Fri, 16 Oct 1998 12:11:53 +0200


Hi,

There is perhaps a problem in some cases when trying to use time.h
As suggested by Masa a few months ago, I ran mkincld.c in cint and
transferred the resulting header files in $ROOTSYS/cint/include.
This cleaned up some problems but there remains one.
After doing a #include <time.h> in the interpreter, the following macro
doesn't work :

{
time_t tt, gts1;
double sampleRate;
tt = time(NULL);
gts1 = mktime(gmtime(&tt));
sampleRate = 2.e+4;
}

namely, it says :

root [31] .x FrTest.C
Error: sampleRate already declared as different type
FILE:/big_data/virgo/users/buskulic/virgo_dev/vega/v0.1/test/./FrTest.C
LINE:6
*** Interpreter error recovered ***

When one replaces the sampleRate=2.e+4 statement by a printf :

{
time_t tt, gts1;
double sampleRate;
sampleRate=0;
tt = time(NULL);
gts1 = mktime(gmtime(&tt));

printf("%f\n", sampleRate);
}

one gets a Syntax error :

Error: Syntax error
FILE:/big_data/virgo/users/buskulic/virgo_dev/vega/v0.1/test/./FrTest.C
LINE:8

The strange thing is that if you execute the instructions interactively,
everything works...

Does somebody have an explanation ? Seems to have something to do with
the way include files are loaded ?

Cheers

Damir

-- 
=====================================================================
| Damir Buskulic                  | Universite de Savoie/LAPP       |
|                                 | Chemin de Bellevue, B.P. 110    |
| Tel : +33 (0)450091600          | F-74941 Annecy-le-Vieux Cedex   |
| e-mail: buskulic@lapp.in2p3.fr  | FRANCE                          |
=====================================================================
mailto:buskulic@lapp.in2p3.fr