|
@ -11,14 +11,6 @@ |
|
|
#include <time64.h> |
|
|
#include <time64.h> |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if 0 // Enable if log needed
|
|
|
|
|
|
#include <android/log.h> |
|
|
|
|
|
#define LOG_TAG "PEPJNIUTILS" |
|
|
|
|
|
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) |
|
|
|
|
|
#else |
|
|
|
|
|
#define LOGD(...) |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
namespace pEp { |
|
|
namespace pEp { |
|
|
namespace JNIAdapter { |
|
|
namespace JNIAdapter { |
|
|
jclass findClass(JNIEnv *env, const char *classname) |
|
|
jclass findClass(JNIEnv *env, const char *classname) |
|
@ -316,15 +308,15 @@ namespace pEp { |
|
|
if (!ts) |
|
|
if (!ts) |
|
|
return (jobject) NULL; |
|
|
return (jobject) NULL; |
|
|
|
|
|
|
|
|
LOGD("/* Seconds (0-60) */ FROM :%d", ts->tm_sec); |
|
|
//LOGD("/* Seconds (0-60) */ FROM :%d", ts->tm_sec);
|
|
|
LOGD("/* Minutes (0-59) */ :%d", ts->tm_min); |
|
|
//LOGD("/* Minutes (0-59) */ :%d", ts->tm_min);
|
|
|
LOGD("/* Hours (0-23) */ :%d", ts->tm_hour); |
|
|
//LOGD("/* Hours (0-23) */ :%d", ts->tm_hour);
|
|
|
LOGD("/* Day of the month (1-31) */:%d", ts->tm_mday); |
|
|
//LOGD("/* Day of the month (1-31) */:%d", ts->tm_mday);
|
|
|
LOGD("/* Month (0-11) */ :%d", ts->tm_mon); |
|
|
//LOGD("/* Month (0-11) */ :%d", ts->tm_mon);
|
|
|
LOGD("/* Year - 1900 */ :%d", ts->tm_year); |
|
|
//LOGD("/* Year - 1900 */ :%d", ts->tm_year);
|
|
|
|
|
|
|
|
|
time64_t t = timegm64(ts)*1000; |
|
|
time64_t t = timegm64(ts)*1000; |
|
|
LOGD( "TimeGM returns : %lld", t); |
|
|
//LOGD( "TimeGM returns : %lld", t);
|
|
|
jclass clazz = findClass(env, "java/util/Date"); |
|
|
jclass clazz = findClass(env, "java/util/Date"); |
|
|
jmethodID constructor = env->GetMethodID(clazz, "<init>", "(J)V"); |
|
|
jmethodID constructor = env->GetMethodID(clazz, "<init>", "(J)V"); |
|
|
assert(constructor); |
|
|
assert(constructor); |
|
@ -343,7 +335,7 @@ namespace pEp { |
|
|
return NULL; |
|
|
return NULL; |
|
|
|
|
|
|
|
|
jlong t = callLongMethod(env, date, "getTime"); |
|
|
jlong t = callLongMethod(env, date, "getTime"); |
|
|
LOGD( "Set Time to : %lld", t); |
|
|
//LOGD( "Set Time to : %lld", t);
|
|
|
timestamp *ts = (timestamp*)calloc(1, sizeof(timestamp)); |
|
|
timestamp *ts = (timestamp*)calloc(1, sizeof(timestamp)); |
|
|
assert(ts); |
|
|
assert(ts); |
|
|
if (ts == NULL) |
|
|
if (ts == NULL) |
|
@ -353,12 +345,12 @@ namespace pEp { |
|
|
time64_t clock = t/1000; |
|
|
time64_t clock = t/1000; |
|
|
gmtime64_r(&clock, ts); |
|
|
gmtime64_r(&clock, ts); |
|
|
|
|
|
|
|
|
LOGD("/* Seconds (0-60) */ TO :%d", ts->tm_sec); |
|
|
//LOGD("/* Seconds (0-60) */ TO :%d", ts->tm_sec);
|
|
|
LOGD("/* Minutes (0-59) */ :%d", ts->tm_min); |
|
|
//LOGD("/* Minutes (0-59) */ :%d", ts->tm_min);
|
|
|
LOGD("/* Hours (0-23) */ :%d", ts->tm_hour); |
|
|
//LOGD("/* Hours (0-23) */ :%d", ts->tm_hour);
|
|
|
LOGD("/* Day of the month (1-31) */:%d", ts->tm_mday); |
|
|
//LOGD("/* Day of the month (1-31) */:%d", ts->tm_mday);
|
|
|
LOGD("/* Month (0-11) */ :%d", ts->tm_mon); |
|
|
//LOGD("/* Month (0-11) */ :%d", ts->tm_mon);
|
|
|
LOGD("/* Year - 1900 */ :%d", ts->tm_year); |
|
|
//LOGD("/* Year - 1900 */ :%d", ts->tm_year);
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return ts; |
|
|
return ts; |
|
|