Would like some direction with Time of Day program

First off, Hi to everyone I am brand new on this forum.

I was hoping some of you code geniuses might help a coding impaired individual like myself. I have to create this program that puts a timestamp on another program I previously created. Right now Im in the process of trying to obtain time using the gettimeofday function in C++ (We are doing this in Unix btw).

Anyways I have a small section of code ready to compile except i keep getting 2 particular errors. Perhaps if someone could help me in that regard and also give me some advice on how the code looks so far that'd be great...


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
9 #include <curses.h>
     10 #include <sys/time.h>
     11 #include <time.h>
     12 // #include "fmttime.h"
     13ExpandedTime* localTime(struct timeval* tv, ExpandedTime* etime);
     14
     15
     16
     17
     18 struct ExpandedTime
     19 {
     20
     21     double et_usec;
     22     double et_sec;
     23     double et_min;
     24     double et_hour;
     25
     26 };
     27
     28 int main()
     29 {
     30     struct timeval tv;
     31     struct ExpandedTime etime;
     32     gettimeofday(&tv, NULL);
     33     localTime(tv, ExpandedTime);  
     34
     35 }
     36
     37 ExpandedTime* localTime(struct timeval* tv, ExpandedTime* etime)
     38 {
     39
     40 }

Basically right now im just trying to properly use gettimeofday as well as pass the timeval structure defined as tv and the expanded time structure into the actual localtime function....however line 33, where I call the localtime function give me 2 particular errors.

1.) localtime was not declared in this scope
2.) expected primary expression before ')' token

Any help would be much appreciated......

Last edited on
Topic archived. No new replies allowed.