From 523b449add296ded2927b9c0ff372e39db8f4a90 Mon Sep 17 00:00:00 2001 From: Ahmad Kemsan Date: Wed, 21 May 2025 11:26:57 +0530 Subject: [PATCH] feat: add activation last sync date getter --- src/extern_functions.rs | 1 + src/lib.rs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/extern_functions.rs b/src/extern_functions.rs index 0f250dc..1987c0b 100644 --- a/src/extern_functions.rs +++ b/src/extern_functions.rs @@ -70,6 +70,7 @@ extern "C" { pub fn GetLicenseTotalDeactivations(totalDeactivations: *mut c_uint) -> c_int; pub fn GetLicenseCreationDate(creationDate: *mut c_uint) -> c_int; pub fn GetLicenseActivationDate(activationDate: *mut c_uint) -> c_int; + pub fn GetActivationLastSyncedDate(lastSyncedDate: *mut c_uint) -> c_int; pub fn GetLicenseExpiryDate(expiryDate: *mut c_uint) -> c_int; pub fn GetLicenseMaintenanceExpiryDate(maintenanceExpiryDate: *mut c_uint) -> c_int; pub fn GetLicenseMaxAllowedReleaseVersion(maxAllowedReleaseVersion: strtype!(), length: c_uint) -> c_int; diff --git a/src/lib.rs b/src/lib.rs index dad2100..444382f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1046,6 +1046,24 @@ pub fn get_license_activation_date() -> Result { } } +/// Retrieves the activation last synced date timestamp. +/// +/// Initially, this timestamp matches the activation creation date, and then updates with each successful server sync. +/// +/// # Returns +/// +/// Returns `Ok(u32)` with the activation last synced date timestamp if it is retrieved successfully, If an error occurs, an `Err` containing the `LexActivatorError`is returned. + +pub fn get_activation_last_synced_date() -> Result { + let mut last_synced_date: c_uint = 0; + let status = unsafe { GetActivationLastSyncedDate(&mut last_synced_date) }; + if status == 0 { + Ok(last_synced_date) + } else { + return Err(LexActivatorError::from(status)); + } +} + /// Retrieves the expiry date of the license. /// /// # Returns