Commit ddc7b015 authored by Matteo Quintiliani's avatar Matteo Quintiliani

Substituted int64_t in double and minor changes


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@810 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent b2188e78
......@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it
*
* $Id: nmxp_data.h,v 1.27 2008-02-28 08:48:38 mtheo Exp $
* $Id: nmxp_data.h,v 1.28 2008-02-28 14:01:17 mtheo Exp $
*
*/
......@@ -273,7 +273,7 @@ void nmxp_data_swap_4b (int32_t *in);
* \param in Variable length 8 bytes.
*
*/
void nmxp_data_swap_8b (int64_t *in);
void nmxp_data_swap_8b (double *in);
/*! \brief Determine the byte order of the host machine.
......
......@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it
*
* $Id: nmxp_base.c,v 1.59 2008-02-28 08:47:06 mtheo Exp $
* $Id: nmxp_base.c,v 1.60 2008-02-28 14:01:17 mtheo Exp $
*
*/
......@@ -445,7 +445,7 @@ NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_da
if(nmxp_channel_name) {
memcpy(&pTime, &buffer_data[4], 8);
if ( swap ) { nmxp_data_swap_8b((int64_t *) ((void *)&pTime)); }
if ( swap ) { nmxp_data_swap_8b(&pTime); }
memcpy(&netInt, &buffer_data[12], 4);
pNSamp = ntohl(netInt);
......@@ -537,6 +537,8 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data
static int32_t outdata[MAX_OUTDATA];
int32_t nout, i, k;
int32_t prev_xn;
const uint32_t high_scale = 4096 * 2048;
const uint32_t high_scale_p = 4096 * 4096;
char *nmxp_channel_name = NULL;
......@@ -565,8 +567,6 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data
memcpy (&nmx_sample_rate, nmx_hdr+13, 1);
memcpy (&nmx_x0, nmx_hdr+14, 3);
const uint32_t high_scale = 4096 * 2048;
const uint32_t high_scale_p = 4096 * 4096;
/* check if nmx_x0 is negative like as signed 3-byte int */
if( (nmx_x0 & high_scale) == high_scale) {
/* nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "WARNING: changed nmx_x0, old value = %d\n", nmx_x0);*/
......
......@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it
*
* $Id: nmxp_data.c,v 1.52 2008-02-28 09:00:48 mtheo Exp $
* $Id: nmxp_data.c,v 1.53 2008-02-28 14:01:17 mtheo Exp $
*
*/
......@@ -388,6 +388,13 @@ int nmxp_data_parse_date(const char *pstr_date, NMXP_TM_T *ret_tmt) {
int state;
int flag_finished = 0;
time_t time_now;
struct tm *tm_now;
int month_days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int m, d, day_sum, jday=app;
nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_DATE, "Date to validate '%s'\n", NMXP_LOG_STR(pstr_date));
strncpy(str_date, pstr_date, MAX_LENGTH_STR_MESSAGE);
......@@ -407,10 +414,6 @@ int nmxp_data_parse_date(const char *pstr_date, NMXP_TM_T *ret_tmt) {
}
/* initialize ret_tmt */
time_t time_now;
struct tm *tm_now;
time(&time_now);
tm_now = gmtime(&time_now);
ret_tmt->t.tm_sec = 0 ;
ret_tmt->t.tm_min = 0;
......@@ -477,9 +480,6 @@ int nmxp_data_parse_date(const char *pstr_date, NMXP_TM_T *ret_tmt) {
case 3: /* Parse Julian Day */
ret_tmt->t.tm_yday = app - 1;
int month_days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int m, d, day_sum, jday=app;
if(NMXP_DATA_IS_LEAP(ret_tmt->t.tm_year)) {
month_days[1]++;
}
......@@ -742,7 +742,7 @@ void nmxp_data_swap_4b (int32_t *in) {
}
void nmxp_data_swap_8b (int64_t *in) {
void nmxp_data_swap_8b (double *in) {
unsigned char *p = (unsigned char *)in;
unsigned char tmp;
tmp = *p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment