Skip to content

F2592 locale date time#2677

Open
shewitt-au wants to merge 76 commits into
WerWolv:masterfrom
shewitt-au:F2592-Locale-date-time
Open

F2592 locale date time#2677
shewitt-au wants to merge 76 commits into
WerWolv:masterfrom
shewitt-au:F2592-Locale-date-time

Conversation

@shewitt-au
Copy link
Copy Markdown
Contributor

@shewitt-au shewitt-au commented Mar 9, 2026

Problem description

Dates and times currently have a fixed format and do not respect the selected language. MinGW’s (Windows) std::locale class is broken and basically useless. This PR implements, along with the libwolv PR linked below, date and time formatting using the Win32 API on Windows and the C runtime library on other OSes.

The motivating feature request can be found here:
Format time based on locale #2592

The corresponding libwolv changes can be found here:
libwolv

The corresponding PatternLanguage changes can be found here:
PatternLanguage

The corresponding ImHex-Patterns changes:
ImHex-Patterns

Implementation description

For the most part, ImHex has been changed to use a new function in libwolv for date and time formatting. A notification was also added to update the Data Inspector when the language is changed. Some changes were made to fix issues in the existing code that make sense even without the broader changes:

  • The time formatting code was using the local time zone instead of GMT.
  • time_t was being treated as unsigned, but it should be signed.
  • When there was a formatting issue with a time_t "Invalid" was displayed. No time_t is invalid. The issue is with our ability to format it. I have changed the message to "Can't format" for now.
  • time32_t was only present on Windows. Now it's always available.
  • DOSDate & DOSTime not the correct size. That messed up endian conversions and created issues when they were placed at the end of a file.

Linux

On Linux only dates and times for which a locale is installed (sudo locale-gen) will be formatted correctly.

@shewitt-au shewitt-au marked this pull request as ready for review March 11, 2026 15:28
@shewitt-au
Copy link
Copy Markdown
Contributor Author

shewitt-au commented May 24, 2026

@WerWolv

I have added locale filtering as I had started but not finished it. The locale drop down is now filtered to only show locales with the selected language. I do not plan on spending any more time on this. Seems pointless given the total lack of feedback.

Anyway, here's a (somewhat clumsy) demonstration:

ldtf.mp4

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