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