Peace upon you every one,
i’m trying to get the current date and time using the stander C library or the Linux native API
i was trying to call the function gettimeofday() but i’m having a problem identifying the parameters type !!!
i’m trying to call the function like that
//get current time
struct timeval current_time = {0,0};
int result = gettimeofday(¤t_time,NULL);
but i get the following compiler error (i’m using gcc)
main_code.c: In function ‘main’:
main_code.c:35:9: error: variable ‘current_time’ has initializer but incomplete type
main_code.c:35:9: warning: excess elements in struct initializer
main_code.c:35:9: warning: (near initialization for ‘current_time’)
main_code.c:35:9: warning: excess elements in struct initializer
main_code.c:35:9: warning: (near initialization for ‘current_time’)
main_code.c:35:17: error: storage size of ‘current_time’ isn’t known
any way do you know a good method to use …??