|
a/src/utils/smallut.cpp |
|
b/src/utils/smallut.cpp |
|
... |
|
... |
25 |
#include <unistd.h>
|
25 |
#include <unistd.h>
|
26 |
#include <errno.h>
|
26 |
#include <errno.h>
|
27 |
#include <sys/time.h>
|
27 |
#include <sys/time.h>
|
28 |
#include <sys/types.h>
|
28 |
#include <sys/types.h>
|
29 |
#include <sys/stat.h>
|
29 |
#include <sys/stat.h>
|
|
|
30 |
#include <string.h>
|
30 |
|
31 |
|
31 |
#include <string>
|
32 |
#include <string>
|
32 |
#include <iostream>
|
33 |
#include <iostream>
|
33 |
|
34 |
|
34 |
#include "smallut.h"
|
35 |
#include "smallut.h"
|
|
... |
|
... |
805 |
// timegm sort it out
|
806 |
// timegm sort it out
|
806 |
memset(&tm, 0, sizeof(tm));
|
807 |
memset(&tm, 0, sizeof(tm));
|
807 |
tm.tm_year = dp->y1 - 1900 + pp->y1;
|
808 |
tm.tm_year = dp->y1 - 1900 + pp->y1;
|
808 |
tm.tm_mon = dp->m1 + pp->m1 -1;
|
809 |
tm.tm_mon = dp->m1 + pp->m1 -1;
|
809 |
tm.tm_mday = dp->d1 + pp->d1;
|
810 |
tm.tm_mday = dp->d1 + pp->d1;
|
|
|
811 |
#ifdef sun
|
|
|
812 |
time_t tres = mktime(&tm);
|
|
|
813 |
localtime_r(&tres, &tm);
|
|
|
814 |
#else
|
810 |
time_t tres = timegm(&tm);
|
815 |
time_t tres = timegm(&tm);
|
811 |
// Convert back to normalized tm, then output
|
|
|
812 |
gmtime_r(&tres, &tm);
|
816 |
gmtime_r(&tres, &tm);
|
|
|
817 |
#endif
|
813 |
dp->y1 = tm.tm_year + 1900;
|
818 |
dp->y1 = tm.tm_year + 1900;
|
814 |
dp->m1 = tm.tm_mon + 1;
|
819 |
dp->m1 = tm.tm_mon + 1;
|
815 |
dp->d1 = tm.tm_mday;
|
820 |
dp->d1 = tm.tm_mday;
|
816 |
//cerrdip("Addperiod return", dp);
|
821 |
//cerrdip("Addperiod return", dp);
|
817 |
return true;
|
822 |
return true;
|