Commit 2987658e authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

clibtime.c was split into Cwrapper files

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 224
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 2ea8016f
This is a legacy version of the repository. It may be incomplete as well as
inconsistent. See README.history for details. For the old stock of the
repository copyright and licence conditions apply as specified for versions
commited after 2015-03-01. Use recent versions as a base for new development.
The legacy version is only stored to keep a record of history.
/* this is <ctime_add.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_add.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_add libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_add(time_Ts Date1, time_Ts Date2, time_Ts *Pdate3)
{
time_Tu *u1;
time_Tu *u2;
time_Tu *u3;
extern int time_add__();
u1=(time_Tu *)&Date1;
u2=(time_Tu *)&Date2;
u3=(time_Tu *)Pdate3;
time_add__(&u1->farray, &u2->farray, &u3->farray);
} /* time_add */
/* ----- END OF ctime_add.c ----- */
/* this is <ctime_clear.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_clear.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_clear libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_clear(time_Ts* Pdate)
{
time_Tu *u;
extern int time_clear__();
u=(time_Tu *)Pdate;
time_clear__(&u->farray);
} /* time_clear */
/* ----- END OF ctime_clear.c ----- */
/* this is <ctime_compare.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_compare.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_compare libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
long int time_compare(time_Ts Date1, time_Ts Date2)
{
time_Tu *u1;
time_Tu *u2;
extern integer time_compare__();
u1=(time_Tu *)&Date1;
u2=(time_Tu *)&Date2;
return((long int)time_compare__(&u1->farray, &u2->farray));
} /* time_compare */
/* ----- END OF ctime_compare.c ----- */
/* this is <ctime_copy.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_copy.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_copy libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_copy(time_Ts Date1, time_Ts *Pdate2)
{
time_Tu *u1;
time_Tu *u2;
extern int time_copy__();
u1=(time_Tu *)&Date1;
u2=(time_Tu *)Pdate2;
time_copy__(&u1->farray, &u2->farray);
} /* time_copy */
/* ----- END OF ctime_copy.c ----- */
/* this is <ctime_div.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_div.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_libversion libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_div(time_Ts Date1, time_Ts *Pdate2, long int n, long int *rest)
{
time_Tu *u1;
time_Tu *u2;
extern int time_div__();
u1=(time_Tu *)&Date1;
u2=(time_Tu *)Pdate2;
time_div__(&u1->farray, &u2->farray, &n, rest);
} /* time_div */
/* ----- END OF ctime_div.c ----- */
/* this is <ctime_finish.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_finish.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_finish libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_finish(time_Ts *Pdate)
{
time_Tu *u;
extern int time_finish__();
u=(time_Tu *)Pdate;
time_finish__(&u->farray);
} /* time_finish */
/* ----- END OF ctime_finish.c ----- */
/* this is <ctime_fullyear.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_fullyear.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_fullyear libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_fullyear(long int *year)
{
extern int time_fullyear__();
time_fullyear__(year);
} /* time_fullyear */
/* ----- END OF ctime_fullyear.c ----- */
/* this is <ctime_getdate.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_getdate.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_getdate libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_getdate(long int *day, long int *month, time_Ts Date)
{
time_Tu *u;
extern int time_getdate__();
u=(time_Tu *)&Date;
time_getdate__(day, month, &u->farray);
} /* time_getdate */
/* ----- END OF ctime_getdate.c ----- */
/* this is <ctime_isleapyear.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_isleapyear.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_isleapyear libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
long int time_isleapyear(long int year)
{
extern logical time_isleapyear__();
return ((long int)time_isleapyear__((integer *)&year));
} /* time_isleapyear */
/* ----- END OF ctime_isleapyear.c ----- */
/* this is <ctime_libversion.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_libversion.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_libversion libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
double time_libversion()
{
extern doublereal time_libversion__();
return((double)time_libversion__());
} /* time_libversion */
/* ----- END OF ctime_libversion.c ----- */
/* this is <ctime_mul.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_mul.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_mul libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_mul(time_Ts Date1, time_Ts *Pdate2, long int n)
{
time_Tu *u1;
time_Tu *u2;
extern int time_mul__();
u1=(time_Tu *)&Date1;
u2=(time_Tu *)Pdate2;
time_mul__(&u1->farray, &u2->farray, &n);
} /* time_mul */
/* ----- END OF ctime_mul.c ----- */
/* this is <ctime_nfit.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_nfit.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_nfit libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_nfit(time_Ts Date1, time_Ts Date2, long int *n, time_Ts *Pfull)
{
time_Tu *u1;
time_Tu *u2;
time_Tu *full;
extern int time_nfit__();
u1=(time_Tu *)&Date1;
u2=(time_Tu *)&Date2;
full=(time_Tu *)Pfull;
time_nfit__(&u1->farray, &u2->farray, n, &full->farray);
} /* time_nfit */
/* ----- END OF ctime_nfit.c ----- */
/* this is <ctime_norm.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_norm.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_norm libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_norm(time_Ts *Pdate)
{
time_Tu *u;
extern int time_norm__();
u=(time_Tu *)Pdate;
time_norm__(&u->farray);
} /* time_norm */
/* ----- END OF ctime_norm.c ----- */
/* this is <ctime_read.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_read.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* fill a time_Ts structure from a character string
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
#include <string.h>
int time_read(time_Ts *Date, char *String)
{
double sec;
char *ptr;
char cmilmicsec[7];
long int day, month, milmicsec;
int i;
time_clear(Date);
ptr=String;
ptr=strpbrk(ptr, "0123456789");
RETURNERROR((ptr==NULL), "time_read", \
"year is missing", EXIT_FAILURE)
Date->year=strtol(ptr, &ptr, 10);
ptr=strpbrk(ptr, "0123456789");
RETURNERROR((ptr==NULL), "time_read", \
"month is missing", EXIT_FAILURE)
month=strtol(ptr, &ptr, 10);
ptr=strpbrk(ptr, "0123456789");
RETURNERROR((ptr==NULL), "time_read", \
"day is missing", EXIT_FAILURE)
day=strtol(ptr, &ptr, 10);
ptr=strpbrk(ptr, "0123456789");
if (ptr!=NULL) {
Date->hour=strtol(ptr, &ptr, 10);
ptr=strpbrk(ptr, "0123456789");
}
if (ptr!=NULL) {
Date->minute=strtol(ptr, &ptr, 10);
ptr=strpbrk(ptr, "0123456789");
}
if (ptr!=NULL) {
Date->second=strtol(ptr, &ptr, 10);
ptr=strpbrk(ptr, "0123456789");
}
if (ptr!=NULL) {
for(i=0; i<6; i++) {
if (ptr!=NULL) {
if (isdigit(ptr[i])) {
cmilmicsec[i]=ptr[i];
} else {
ptr=NULL;
cmilmicsec[i]='0';
}
} else {
cmilmicsec[i]='0';
}
cmilmicsec[6]='\0';
}
milmicsec=strtol(cmilmicsec, &ptr, 10);
Date->milsec=(long int)(milmicsec/1000);
Date->micsec=milmicsec-(Date->milsec*1000);
}
if (month>0) { time_fullyear(&Date->year); }
time_setdoy(day, month, Date);
time_finish(Date);
time_norm(Date);
return(EXIT_SUCCESS);
} /* time_read */
/* ----- END OF ctime_read.c ----- */
/* this is <ctime_setdoy.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_setdoy.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_setdoy libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_setdoy(long int day, long int month, time_Ts *Pdate)
{
time_Tu *u;
extern int time_setdoy__();
u=(time_Tu *)Pdate;
time_setdoy__(&day, &month, &u->farray);
} /* time_setdoy */
/* ----- END OF ctime_setdoy.c ----- */
/* this is <ctime_sprint.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_sprint.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* libtime C kernel function
*
* NOTICE: This routine returns a pointer to a static character array. The
* next call to time_sprint will destroy the contents of this string.
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
#include <stdio.h>
char *time_sprint(time_Ts Date)
{
long int day;
long int month;
static char sdate[TIME_SLEN];
time_norm(&Date);
if (Date.year == 0L) {
sprintf(sdate, "%03dd %02dh %02dm %02d.%03d%03ds", Date.doy,
Date.hour, Date.minute, Date.second, Date.milsec, Date.micsec);
} else {
time_getdate(&day, &month, Date);
sprintf(sdate, "%03d %02d/%02d/%04d %02d:%02d:%02d.%03d%03d",
Date.doy, day, month, Date.year,
Date.hour, Date.minute, Date.second, Date.milsec, Date.micsec);
}
return(sdate);
} /* time_setdoy */
/* ----- END OF ctime_sprint.c ----- */
/* this is <ctime_sub.c>
* ----------------------------------------------------------------------------
*
* $Id: ctime_sub.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* C-wrapper for FORTRAN time_sub libtime kernel function
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#include <libtime.h>
void time_sub(time_Ts Date1, time_Ts Date2, time_Ts *Pdate3)
{
time_Tu *u1;
time_Tu *u2;
time_Tu *u3;
extern int time_sub__();
u1=(time_Tu *)&Date1;
u2=(time_Tu *)&Date2;
u3=(time_Tu *)Pdate3;
time_sub__(&u1->farray, &u2->farray, &u3->farray);
} /* time_sub */
/* ----- END OF ctime_sub.c ----- */
/* this is <ctime_util_fatal.c>
* ----------------------------------------------------------------------------
*
* $Source: /home/tforb/svnbuild/cvssource/CVS/thof/src/libs/libtime/Cwrapper/ctime_util_fatal.c,v $
* $Id: ctime_util_fatal.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* PURPOSE
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
/* ----- END OF ctime_util_fatal.c ----- */
/* this is <ctime_util_warning.c>
* ----------------------------------------------------------------------------
*
* $Source: /home/tforb/svnbuild/cvssource/CVS/thof/src/libs/libtime/Cwrapper/ctime_util_warning.c,v $
* $Id: ctime_util_warning.c,v 1.1 2000-08-06 12:00:39 thof Exp $
*
* 06/08/2000 by Thomas Forbriger (IfG Stuttgart)
*
* PURPOSE
*
* REVISIONS and CHANGES
* 06/08/2000 V1.0 Thomas Forbriger
*
* ============================================================================
*/
/* ----- END OF ctime_util_warning.c ----- */
Supports Markdown
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