Skip to content

Add POSIX::strftime and POSIX::mktime Perl wrappers#302

Merged
fglock merged 2 commits intomasterfrom
fix/posix-strftime-mktime
Mar 11, 2026
Merged

Add POSIX::strftime and POSIX::mktime Perl wrappers#302
fglock merged 2 commits intomasterfrom
fix/posix-strftime-mktime

Conversation

@fglock
Copy link
Owner

@fglock fglock commented Mar 11, 2026

Summary

  • Add missing Perl wrapper functions for strftime and mktime in POSIX.pm
  • The Java implementations already existed (registered as _strftime and _mktime in POSIX.java), but the Perl-side wrappers were missing

Problem

Calling POSIX::strftime() resulted in "Undefined subroutine" error because the wrapper function was not defined in POSIX.pm, even though the Java XS implementation was already registered.

Fix

Added two wrapper functions to POSIX.pm:

sub strftime { POSIX::_strftime(@_) }
sub mktime { POSIX::_mktime(@_) }

Testing

  • ExifTool Writer test 23: Now passes (was failing due to DateFormat option using strftime internally)
  • POSIX::strftime basic test: ./jperl -e 'use POSIX qw(strftime); print strftime("%Y-%m-%d", localtime())' now works

Remaining Issue

MWG test 3 still fails with a timezone conversion issue (time 15:13:44-04:00 becomes 02:11:11+01:00). This is a separate bug unrelated to strftime and will be addressed in a follow-up PR.

Generated with Devin

fglock and others added 2 commits March 11, 2026 22:29
The Java implementations for strftime and mktime already exist in
POSIX.java (registered as _strftime and _mktime), but the Perl
wrapper functions were missing from POSIX.pm, causing "Undefined
subroutine" errors when calling these functions.

This fixes ExifTool Writer test 23 which uses DateFormat option
(internally calls POSIX::strftime for date formatting).

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <noreply@cognition.ai>
When ASM frame computation crashes during JVM bytecode generation,
getBytecode() throws InterpreterFallbackException with the already-
compiled InterpretedCode. Previously, createRuntimeCode() did not
catch this exception specifically, so it propagated up to eval STRING
handlers which treated it as a compilation error.

This fix catches InterpreterFallbackException and returns its
interpretedCode directly, allowing subroutines like IPTC::IptcTime
to work correctly even when they trigger ASM crashes.

Fixes ExifTool MWG test 3 (IPTC:TimeCreated was retaining original
value instead of being updated because SetNewValue was failing).

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <noreply@cognition.ai>
@fglock fglock merged commit 587670a into master Mar 11, 2026
2 checks passed
@fglock fglock deleted the fix/posix-strftime-mktime branch March 11, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant