MISR Toolkit  1.5.1
MtkJulianToDateTime.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = MtkJulianToDateTime =
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 <math.h>
20 #include <string.h>
21 
35  double jd,
36  char datetime[MTKd_DATETIME_LEN] )
37 {
38  MTKt_status status; /* Return status */
39  MTKt_status status_code; /* Return code of this function */
40  int year, month, day, hour, min, sec;
41 
42  if (datetime == NULL)
44 
45  if (jd < 1721119.5)
47 
48  status = MtkJulianToCal(jd,&year,&month,&day,&hour,&min,&sec);
49  MTK_ERR_COND_JUMP(status);
50 
51  sprintf(datetime,"%04d-%02d-%02dT%02d:%02d:%02dZ",year,month,day,hour,min,sec);
52 
53  return MTK_SUCCESS;
54 
55 ERROR_HANDLE:
56  return status_code;
57 }
#define MTK_ERR_CODE_JUMP(code)
Definition: MisrError.h:175
MTKt_status MtkJulianToCal(double jd, int *year, int *month, int *day, int *hour, int *min, int *sec)
Convert Julian date to calendar date.
#define MTK_ERR_COND_JUMP(code)
Definition: MisrError.h:188
MTKt_status
Definition: MisrError.h:11
MTKt_status MtkJulianToDateTime(double jd, char datetime[MTKd_DATETIME_LEN])
Convert Julian date to date and time (ISO 8601)
HDFFCLIBAPI void * min
#define MTKd_DATETIME_LEN
Definition: MisrUtil.h:149

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