IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 22710


Ignore:
Timestamp:
Feb 27, 2009, 1:09:31 PM (17 years ago)
Author:
Paul Price
Message:

Make the number of decimals used by psTimeToISO configurable. MySQL can't handle more than 6 decimals (and it strips those off anyway). By doing this, we can keep MySQL happy, and still preserve the option of printing everything.

Location:
trunk/psLib/src/astro
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psTime.c

    r22705 r22710  
    6161static char *timeConfig = NULL;         // Time config file path
    6262static psMetadata *timeMetadata = NULL; // Time metadata read from config file
     63static int isoDecimals = 6;             // Number of decimals to use in a string by psTimeToISO
    6364
    6465
     
    13531354}
    13541355
     1356
     1357int psTimeSetISODecimals(int num)
     1358{
     1359    int temp = isoDecimals;          // Current value, to return
     1360    isoDecimals = num;
     1361    return temp;
     1362}
     1363
     1364int psTimeGetISODecimals(void)
     1365{
     1366    return isoDecimals;
     1367}
     1368
    13551369psString psTimeToISO(const psTime *time)
    13561370{
    1357     return timeToString(time, 9);       // Use all 9 decimals allowed by the nanoseconds
     1371    return timeToString(time, isoDecimals);
    13581372}
    13591373
  • trunk/psLib/src/astro/psTime.h

    r22682 r22710  
    241241/** Convert psTime to ISO8601 formatted string.
    242242 *
    243  *  Converts psTime to a null terminated string in the form of YYYY-MM-DDThh:mm:ss.sssssssss.
     243 *  Converts psTime to a null terminated string in the form of YYYY-MM-DDThh:mm:ss.ssssss
    244244 *  This function does not add or subtract leapseconds.
    245245 *
     
    249249    const psTime* time                  ///< Input time to be converted.
    250250);
     251
     252/** Set number of decimals printed by psTimeToISO
     253 *
     254 * @return int: Previous setting
     255 */
     256int psTimeSetISODecimals(
     257    int num                             ///< Number of decimals to print
     258    );
     259
     260/** Get number of decimals printed by psTimeToISO
     261 *
     262 * @return int: Current setting
     263 */
     264int psTimeGetISODecimals(void);
    251265
    252266/** Convert psTime to ISO8601 formatted string with limited decimal places
Note: See TracChangeset for help on using the changeset viewer.