Browse Source

Adjust signature of JNI system time call

Patrick-Christopher Mattulat 1 year ago
parent
commit
e5f38eafbf

+ 8 - 7
include/ls-std/time/system-time/jni/com_lynarstudios_ls_std_time_systemtime_SystemTimeJni.h

@@ -3,18 +3,19 @@
 /* Header for class com_lynarstudios_ls_std_time_systemtime_SystemTimeJni */
 
 #ifndef _Included_com_lynarstudios_ls_std_time_systemtime_SystemTimeJni
-  #define _Included_com_lynarstudios_ls_std_time_systemtime_SystemTimeJni
-  #ifdef __cplusplus
+#define _Included_com_lynarstudios_ls_std_time_systemtime_SystemTimeJni
+#ifdef __cplusplus
 extern "C" {
-  #endif
+#endif
 /*
  * Class:     com_lynarstudios_ls_std_time_systemtime_SystemTimeJni
  * Method:    set
- * Signature: (J)Z
+ * Signature: (Lcom/lynarstudios/ls/std/time/systemtime/DateParameter;)Z
  */
-JNIEXPORT jboolean JNICALL Java_com_lynarstudios_ls_std_time_systemtime_SystemTimeJni_set(JNIEnv *, jobject, jlong);
+JNIEXPORT jboolean JNICALL Java_com_lynarstudios_ls_std_time_systemtime_SystemTimeJni_set
+  (JNIEnv *, jobject, jobject);
 
-  #ifdef __cplusplus
+#ifdef __cplusplus
 }
-  #endif
+#endif
 #endif

+ 8 - 3
source/ls-std/time/system-time/jni/com_lynarstudios_ls_std_time_systemtime_SystemTimeJni.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-03-16
-* Changed:         2023-03-31
+* Changed:         2023-04-03
 *
 * */
 
@@ -12,8 +12,13 @@
 
 using ls::std::time::DateParameter;
 using ls::std::time::SystemTime;
+using ls::std::time::type::Day;
 
-JNIEXPORT jboolean JNICALL Java_com_lynarstudios_ls_std_time_systemtime_SystemTimeJni_set(JNIEnv *_environment, jobject _object, jlong _long)
+JNIEXPORT jboolean JNICALL Java_com_lynarstudios_ls_std_time_systemtime_SystemTimeJni_set(JNIEnv *_environment, jobject _object, jobject _dateParameter)
 {
-  return SystemTime{}.set(DateParameter{});
+  jclass dateParameterClass = _environment->GetObjectClass(_dateParameter);
+  jmethodID getDayMethodId = _environment->GetMethodID(dateParameterClass, "getDay", "byte");
+  DateParameter dateParameter{};
+
+  return SystemTime{}.set(dateParameter);
 }