MISR Toolkit  1.5.1
MtkDateTimeToJulian.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = MtkDateTimeToJulian =
4 = =
5 =============================================================================
6 
7  Jet Propulsion Laboratory
8  MISR
9  MISR Toolkit
10 
11  Copyright 2006, California Institute of Technology.
12  ALL RIGHTS RESERVED.
13  U.S. Government Sponsorship acknowledged.
14 
15 ============================================================================*/
16 
17 #include "MisrUtil.h"
18 #include "MisrError.h"
19 #include <stdio.h>
20 
34  const char *datetime,
35  double *jd )
36 {
37  MTKt_status status; /* Return status */
38  MTKt_status status_code; /* Return code of this function */
39  int year, month, day, hour, min, sec;
40  int num_values;
41 
42  if (datetime == NULL || jd == NULL)
44 
45  num_values = sscanf(datetime,"%4d-%2d-%2dT%2d:%2d:%2d",&year,&month,
46  &day,&hour,&min,&sec);
47 
48  if (num_values != 6)
50 
51  status = MtkCalToJulian(year,month,day,hour,min,sec,jd);
52  MTK_ERR_COND_JUMP(status);
53 
54  return MTK_SUCCESS;
55 
56 ERROR_HANDLE:
57  return status_code;
58 }
MTKt_status MtkCalToJulian(int y, int m, int d, int h, int mn, int s, double *julian)
Convert calendar date to Julian date.
MTKt_status MtkDateTimeToJulian(const char *datetime, double *jd)
Convert date and time (ISO 8601) to Julian date.
#define MTK_ERR_CODE_JUMP(code)
Definition: MisrError.h:175
#define MTK_ERR_COND_JUMP(code)
Definition: MisrError.h:188
MTKt_status
Definition: MisrError.h:11
HDFFCLIBAPI void * min

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:51