Jni调用Date类产生时间

这里只贴出c代码

JNIEXPORT jlong JNICALL Java_jni_JniTest_getTime
(JNIEnv * env, jclass obj){
	jclass cls = env->FindClass("java/util/Date");
	jmethodID conmid = env->GetMethodID(cls,"<init>","()V");
	jobject obj1 = env->NewObject(cls,conmid);
	jmethodID getTimeID = env->GetMethodID(cls,"getTime","()J");
	jlong time = env->CallNonvirtualLongMethod(obj1,cls,getTimeID);
	return time;
}


你可能感兴趣的:(Jni调用Date类产生时间)