PLplot 5.9.6
|
00001 /* $Id$ 00002 * 00003 * Routines for interfacing with qsastime library routines. 00004 * 00005 * Copyright (C) 2009 Alan W. Irwin 00006 * 00007 * This file is part of PLplot. 00008 * 00009 * PLplot is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Library Public License as published 00011 * by the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * PLplot is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU Library General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Library General Public License 00020 * along with PLplot; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 */ 00023 00024 #include "plplotP.h" 00025 00026 /* Calculate broken-down time from continuous time for current stream. */ 00027 void 00028 c_plbtime( PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec, PLFLT ctime ) 00029 { 00030 btimeqsas( year, month, day, hour, min, sec, ctime, plsc->qsasconfig ); 00031 } 00032 00033 /* Configure transformation between continuous and broken-down time (and 00034 * vice versa) for current stream. */ 00035 void 00036 c_plconfigtime( PLFLT scale, PLFLT offset1, PLFLT offset2, PLINT ccontrol, PLBOOL ifbtime_offset, PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec ) 00037 { 00038 if ( scale == 0. ) 00039 { 00040 /* Default transformation between continuous and broken-down time 00041 * (and vice versa) defined here for PLplot. */ 00042 /* Note the PLplot default is not necessarily the same as the 00043 * libqsastime default. */ 00044 configqsas( 1. / 86400., 0., 0., 0x0, 1, 1970, 0, 1, 0, 0, 0., &( plsc->qsasconfig ) ); 00045 } 00046 else 00047 { 00048 configqsas( scale, offset1, offset2, ccontrol, ifbtime_offset, year, month, day, hour, min, sec, &( plsc->qsasconfig ) ); 00049 } 00050 } 00051 00052 /* Calculate continuous time from broken-down time for current stream. */ 00053 void 00054 c_plctime( PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec, PLFLT *ctime ) 00055 { 00056 int ret; 00057 ret = ctimeqsas( year, month, day, hour, min, sec, ctime, plsc->qsasconfig ); 00058 if ( ret ) 00059 plabort( "plctime: ctimeqsas detected error" ); 00060 } 00061 00062 /* Set format for date / time labels. */ 00063 void 00064 c_pltimefmt( const char *fmt ) 00065 { 00066 if ( plsc->timefmt ) 00067 free_mem( plsc->timefmt ); 00068 00069 plsc->timefmt = (char *) malloc( (size_t) ( strlen( fmt ) + 1 ) ); 00070 strcpy( plsc->timefmt, fmt ); 00071 } 00072