Skip to content

Commit

Permalink
Fixed the size of the TM struct: 36 on Windows, 56 on others (glibc).
Browse files Browse the repository at this point in the history
Fix #9
  • Loading branch information
kojix2 committed Oct 15, 2021
1 parent 1f2c776 commit 29ff9ce
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions lib/libui/ffi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,33 @@ def ffi_methods
# uiDateTimePicker

# time.h
TM = struct [
'int tm_sec',
'int tm_min',
'int tm_hour',
'int tm_mday',
'int tm_mon',
'int tm_year',
'int tm_wday',
'int tm_yday',
'int tm_isdst'
]
TM = if Fiddle::WINDOWS
struct [
'int tm_sec',
'int tm_min',
'int tm_hour',
'int tm_mday',
'int tm_mon',
'int tm_year',
'int tm_wday',
'int tm_yday',
'int tm_isdst'
]
else # The GNU C Library (glibc)
struct [
'int tm_sec',
'int tm_min',
'int tm_hour',
'int tm_mday',
'int tm_mon',
'int tm_year',
'int tm_wday',
'int tm_yday',
'int tm_isdst',
'long tm_gmtoff',
'const char *tm_zone'
]
end

try_extern 'void uiDateTimePickerTime(uiDateTimePicker *d, struct tm *time)'
try_extern 'void uiDateTimePickerSetTime(uiDateTimePicker *d, const struct tm *time)'
Expand Down

0 comments on commit 29ff9ce

Please sign in to comment.