Search Results

Search found 4 results on 1 pages for 'mjd'.

Page 1/1 | 1 

  • recommended format to save time with MJD + BCD format in database

    - by pierr
    Hi, There is a time represented in MJD and BCD format with 5 bytes .I am wondering what is the recommended format to save this date-time in the sqlite database so that user can search against it ? My first attempt is to save it just as it is, that is a 5 bytes string. The user will use the same format to search and the result will be converted to unix time by the user with following code. However, later, I was suggested to save the time in the integer - the UTC time, for example. But I can not find a standard way to do the conversion. I feel this is a common issue and would like to hear your comments. time_t sidate_to_unixtime(unsigned char sidate[]) { int k = 0; struct tm tm; double mjd; /* check for the undefined value */ if ((sidate[0] == 0xff) && (sidate[1] == 0xff) && (sidate[2] == 0xff) && (sidate[3] == 0xff) && (sidate[4] == 0xff)) { return -1; } memset(&tm, 0, sizeof(tm)); mjd = (sidate[0] << 8) | sidate[1]; tm.tm_year = (int) ((mjd - 15078.2) / 365.25); tm.tm_mon = (int) (((mjd - 14956.1) - (int) (tm.tm_year * 365.25)) / 30.6001); tm.tm_mday = (int) mjd - 14956 - (int) (tm.tm_year * 365.25) - (int) (tm.tm_mon * 30.6001); if ((tm.tm_mon == 14) || (tm.tm_mon == 15)) k = 1; tm.tm_year += k; tm.tm_mon = tm.tm_mon - 2 - k * 12; tm.tm_sec = bcd_to_integer(sidate[4]); tm.tm_min = bcd_to_integer(sidate[3]); tm.tm_hour = bcd_to_integer(sidate[2]); return mktime(&tm); }

    Read the article

  • how can I reset field after check it with php

    - by mjd
    Hi all, I have a html form that sends the data from 2 fields (memer no. , pw) via axaj (getElementById)to php file to check them with database info. . I did every thing well but I want to reset both fields if one of them is incorrect . How can I send reset order back to html form ? notice - I didn't use submit button just normal button to keep in same page. Thanks all

    Read the article

  • Staticly linked libraries not running code inside to setup static variables.

    - by MJD
    In a c++ project I am working on, I have a simple c++ file that needs to run some code at the beginning of the progam execution. This file is linked into a static library, which is then linked into the main program. I have similar code in other files running fine, that looks something like: bool ____nonexistant_value = executeAction(); However, it does not work inside this file unless I make use of a function implemented in this file. It does work if the library is compilied as a shared library. I'd prefer to link this statically as the library is only a convience as the file is in a different directory.

    Read the article

  • Statically linked libraries not running code inside to setup static variables.

    - by MJD
    In a c++ project I am working on, I have a simple c++ file that needs to run some code at the beginning of the program execution. This file is linked into a static library, which is then linked into the main program. I have similar code in other files running fine, that looks something like: bool ____nonexistent_value = executeAction(); However, it does not work inside this file unless I make use of a function implemented in this file. It does work if the library is compiled as a shared library. I'd prefer to link this statically as the library is only a convenience as the file is in a different directory.

    Read the article

1