00001
00002
00003
00004 #include <stdio.h>
00005 #include <sys/timeb.h>
00006 #include <fcntl.h>
00007 #include <errno.h>
00008
00009 #include "utility.h"
00010
00011 int time_stamp(char *fn, char *event)
00012 {
00013 struct timeb time_stamp;
00014 FILE *target = NULL;
00015
00016 target = fopen (fn, "a");
00017 if(target != NULL) {
00018 ftime(&time_stamp);
00019 fprintf(target, "%-30s%ld.%d\n", event, time_stamp.time, time_stamp.millitm);
00020 fclose(target);
00021 }
00022 return errno;
00023 }
00024
00025 int16_t millisec_get(void)
00026 {
00027 struct timeb time_stamp;
00028
00029 ftime(&time_stamp);
00030 return time_stamp.millitm;
00031 }
00032