libtime++: Date and time calculation

◆ divmultest()

void divmultest ( time_Ts  date1,
long int  n,
time_Ts  date2 
)

Definition at line 91 of file ctlibtime.c.

References time_add(), time_div(), time_mul(), time_nfit(), TIME_SLEN, and time_sprint().

Referenced by main(), and testlibtime().

95 {
96  timeint nfit, rest;
97  time_Ts date3, date4, full;
98  char string1[TIME_SLEN];
99  char string2[TIME_SLEN];
100  char string3[TIME_SLEN];
101  char string4[TIME_SLEN];
102  char stringf[TIME_SLEN];
103  printf("****\n");
104  strcpy(string1,time_sprint(date1));
105  strcpy(string2,time_sprint(date2));
106  printf("date1 is %s\n",string1);
107  printf("date2 is %s\n",string2);
108  time_mul(date1, &date3, n);
109  strcpy(string3,time_sprint(date3));
110  printf("%s * %d -> %s\n",string1, n, string3);
111  time_nfit(date3, date1, &nfit, &full);
112  strcpy(stringf,time_sprint(full));
113  printf("fitting: %d to %s leads to %s\n",nfit,string3,stringf);
114  time_div(date3, &date4, n, &rest);
115  strcpy(string4,time_sprint(date4));
116  printf("%s / %d -> %s rest %d\n",string3,n,string4,rest);
117  time_add(date3, date2, &date4);
118  time_div(date4, &date3, n, &rest);
119  strcpy(string4,time_sprint(date4));
120  strcpy(string3,time_sprint(date3));
121  printf("%s / %d -> %s rest %d\n",string4,n,string3,rest);
122  time_nfit(date4, date1, &nfit, &full);
123  strcpy(stringf,time_sprint(full));
124  printf("fitting: %d to %s leads to %s\n",nfit,string4,stringf);
125  time_add(date4, date1, &date3);
126  strcpy(string3,time_sprint(date3));
127  time_nfit(date3, date1, &nfit, &full);
128  strcpy(stringf,time_sprint(full));
129  printf("fitting: %d to %s leads to %s\n",nfit,string3,stringf);
130 } /* divmultest */
void time_div(time_Ts Date1, time_Ts *Pdate2, timeint n, timeint *rest)
Definition: ctime_div.c:36
char * time_sprint(time_Ts Date)
Definition: ctime_sprint.c:39
void time_add(time_Ts Date1, time_Ts Date2, time_Ts *Pdate3)
Definition: ctime_add.c:33
integer timeint
Definition: libtime.h:77
void time_nfit(time_Ts Date1, time_Ts Date2, timeint *n, time_Ts *Pfull)
Definition: ctime_nfit.c:36
void time_mul(time_Ts Date1, time_Ts *Pdate2, integer n)
Definition: ctime_mul.c:35
#define TIME_SLEN
Definition: libtime.h:113
Here is the call graph for this function:
Here is the caller graph for this function: