S12X - Time clock

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12X - Time clock

1,695 Views
candriver
Contributor I
Hi...
 
In xgate can driver code..i am using this code:
 
#include<time.h>
clock_t start,end;
start=clock();
  
 Int_Init();        /* my function name */  
 
 end=clock()-start;  
now i want to know abt what s the value stored in this end variable.....means can i see the value of this variable......how i can print this variable.
Thanks
 
Alban Edit: part name in subject line

Message Edited by Alban on 2007-03-28 08:36 AM

Labels (1)
0 Kudos
2 Replies

343 Views
Alban
Senior Contributor II
Hello,
 
Please mention device name in the subject line in all your messages.
 
You can see the variable if it is stored in a memory area visible by both cores. XGATE - CPU shared area is a good idea to authorize modification by both cores.
 
Alban.
0 Kudos

343 Views
PsychoDebugger
Contributor I
I didn't know that is possible to use this function in embedded system i read, from codewarrior help:

Time Functions

In the ANSI library, there also are several function to get the current time. In an embedded systems environment, implementations for these functions cannot be provided because different targets may use different ways to count the time

Listing 14.14 ANSI-C time functions

clock_t   clock(void);
time_t    time(time_t *time_val);
struct tm * localtime(const time_t *time_val);
time_t    mktime(struct tm *time_rec);
char      * asctime(const struct tm *time_rec);
char      ctime(const time *time_val);
size_t    strftime(char *s, size_t n,
                   const char *format,
                   const struct tm *time_rec);
double    difftime(time_t t1, time_t t2);
struct tm * gmtime(const time_t *time_val);

0 Kudos