File: cdtime.c

package info (click to toggle)
nco 5.3.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 38,260 kB
  • sloc: ansic: 84,963; cpp: 28,654; sh: 14,071; perl: 5,996; makefile: 2,009; lex: 1,009; python: 127; csh: 40
file content (35 lines) | stat: -rw-r--r-- 936 bytes parent folder | download | duplicates (10)
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
33
34
35
/* Purpose: Illustrate usage of CDAT calendar functions in CF library */

/* Usage:
   gcc -I/usr/local/include -L/usr/local/lib -lcf cdtime.c -o cdtime */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "libcf.h" 

#define True 1
#define False 0

int main(int argc, char **argv){

  char *s_in;  // disk units e.g "days since 170:01:01"
  char *s_out;  //string of value (from hyperslab limit) 

  cdCompTime comptime;  

  s_in=strdup(argv[1]);  // string with number units e.g 10 mm
  s_out=strdup(argv[2]); // output units             e.g feet,inches, "days since 2001:10:12 00:00:01"
  //s_out=strdup("feet");
  printf("system check argv[1]=%s argv[2]=%s\n", s_in,s_out); 
    
  (void)cdChar2Comp(cdStandard,s_in, &comptime);     

  // print out comptime
  printf("input =%s \n", s_in);
  printf("year=%li month=%d day=%d hour=%f \n",comptime.year,comptime.month,comptime.day,comptime.hour);

  exit(0);
}