From 985b5df745b19d002c39ec0499bb16a1fa4e1d3e Mon Sep 17 00:00:00 2001 From: Marco Kuipers Date: Fri, 14 Aug 2026 19:12:03 +0930 Subject: [PATCH 1/2] Guard the CurrentUnixTime global against redefinition JWT/UnixTime.pkg guards its other five definitions - gVoid, tFileTime, tSystemTime, and the two External_Functions - but `Function CurrentUnixTime Global` had no #IFNDEF around it. DataFlex-dev/Security ships a byte-identical copy of this file as include/UnixTime.pkg, also unguarded. DataFlex resolves a Use by path, so to the compiler these are two unrelated files and the global is defined twice: Error 4390: Illegal method name definition Global method GET CURRENTUNIXTIME already defined That combination is not exotic: it is what the OAuth Server Lib needs. OAuth Server Lib requires this package, and any OIDC provider offering TOTP as a second factor also wants cSecureOneTimePassword from Security. The first build putting both in one program fails, pointing at a package-manager-installed file that cannot be edited - so it reads like a broken dependency rather than a name collision. Get_CurrentUnixTime is the symbol a `Function ... Global` defines; the precedent is DataFlex's own cWorkspace.pkg, which guards `Function LastDelimeter Global` with `#IFDEF Get_LastDelimeter`. Verified by compiling this file into a program that already defines CurrentUnixTime: 4390 before, clean after. Guarding either copy fixes the collision. Both are being offered one, so neither library depends on Use order. --- Library/AppSrc/JWT/UnixTime.pkg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/AppSrc/JWT/UnixTime.pkg b/Library/AppSrc/JWT/UnixTime.pkg index cc96221..1ce1537 100644 --- a/Library/AppSrc/JWT/UnixTime.pkg +++ b/Library/AppSrc/JWT/UnixTime.pkg @@ -37,6 +37,7 @@ External_Function WinAPI_SystemTimeToFileTime "SystemTimeToFileTime" Kernel32.dl Returns Boolean #ENDIF +#IFNDEF Get_CurrentUnixTime Function CurrentUnixTime Global Returns UBigInt UBigInt iTime UBigInt iUnixTime @@ -53,6 +54,7 @@ Function CurrentUnixTime Global Returns UBigInt Function_Return iUnixTime End_Function +#ENDIF Function UnixTimeToDateTime Global UBigInt ullUnixTime Returns TimeSpan DateTime dDT From 54a2bcfc875159be2e7dc93eb2989be8d3c9e30f Mon Sep 17 00:00:00 2001 From: Marco Kuipers Date: Fri, 14 Aug 2026 19:17:09 +0930 Subject: [PATCH 2/2] Guard UnixTimeToDateTime as well, so the file is safe to include twice Not needed for the Security collision in the previous commit - Security's copy of this file does not define UnixTimeToDateTime, so that name does not clash between the two libraries today. This is for consistency with the six guards now around it, and it makes the file idempotent: including it a second time by a different path becomes a no-op rather than Error 4390. Demonstrated by compiling this file into a program that already has the whole package. With only CurrentUnixTime guarded: Error 4390: Illegal method name definition Global method GET UNIXTIMETODATETIME already defined With both guarded, it compiles clean. DateTimetoUnixTime below needs no guard and does not get one: it is declared without the Global keyword, and the same double-inclusion test shows it does not collide. Separable from the previous commit - drop this one if you would rather keep the change to the single name that actually clashes. --- Library/AppSrc/JWT/UnixTime.pkg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/AppSrc/JWT/UnixTime.pkg b/Library/AppSrc/JWT/UnixTime.pkg index 1ce1537..696c8e9 100644 --- a/Library/AppSrc/JWT/UnixTime.pkg +++ b/Library/AppSrc/JWT/UnixTime.pkg @@ -56,6 +56,7 @@ Function CurrentUnixTime Global Returns UBigInt End_Function #ENDIF +#IFNDEF Get_UnixTimeToDateTime Function UnixTimeToDateTime Global UBigInt ullUnixTime Returns TimeSpan DateTime dDT TimeSpan tsTimeSpan @@ -81,6 +82,7 @@ Function UnixTimeToDateTime Global UBigInt ullUnixTime Returns TimeSpan Function_Return (dDT + tsTimeSpan) End_Function +#ENDIF Function DateTimetoUnixTime DateTime dtUTCtime Returns UBigInt DateTime dtEpoc