File: time.c

package info (click to toggle)
plotmtv 1.4.1-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,024 kB
  • ctags: 5,006
  • sloc: ansic: 51,179; makefile: 1,976; fortran: 1,277; sh: 510; csh: 439
file content (31 lines) | stat: -rw-r--r-- 561 bytes parent folder | download | duplicates (6)
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
#include <time.h>
#include <sys/types.h>
/*
#include <sys/timeb.h>
 */

/* get the local time */
void CNget_localtime(newtime,maxchar)
char newtime[];
int  maxchar;
{
   char      *ctime();
   time_t    time();

   int       i;
   time_t    timeofday;
   char      *loctime;

   /* get the local time */
   timeofday = time((time_t*)0);
   loctime   = ctime(&timeofday);

   /* loctime has a '\n' in it, so delete that character */
   i=0;
   while ((loctime[i] != '\n') && (i<maxchar)) {
      newtime[i] = loctime[i];
      i++;
   }
   newtime[i] = '\0';
}