ports/x11-toolkits/fox17/files/patch-lib_FXSystemTime.cpp
Jason E. Hale bcd2014823 x11-toolkits/fox17: Update to 1.7.85
Remove the graphics/libpng dependency and configure option. PNG support
is now entirely built-in.

graphics/libGLU is only needed to build the glviewer test program. Its
presence on the host system doesn't affect the installation.

Remove reference to removed port x11-toolkits/fox14.

Pet portclippy(1) and portlint (1).

Update patches due to changes in base and to make them more upstream-
friendly.

Changes:
- New PNG image support. First, its faster! Also, it no longer requires
  libpng; the PNG format support is now built-in, although the libz
  compression library is still required [for now...].
- fxsavePNG() supports some fine-control via new save-flags. You can
  analyze the image, and shrink output by taking advantage of image
  features; for example, saving opaque image means alpha-channel may be
  dropped. If the image is gray-levels only, the RGB may be dropped to
  plain gray only. Also, shrinking further by emitting colormapped
  [indexed-color] image is possible if only a few colors are used.
  Finally, pre-compression filtering, as well as desired compression
  level can be selected.
- PNG I/O is optimized with when target ISA x86-64-v2 or higher are
  selected.
- FXStat::isSame() checks if two files are the same (same inode).
- FOX Desktop Calculator augmented with Unicode button labels (please
  select a font that has the math symbols!), also now supports additional
  functions, common physics constants, and other features.
- The fxCPUFeatures now can detect AVX512 presence.
- New FXPerformanceCounter and associated macros may be used to count
  clockcyles of critical code segments.
- FXAtomic.h APIs now mostly inlined for lower overhead.
- Read processor ticks on AARCH64.
- Adie text editor undo buffer size and undo buffer items can now be
  configured.
- New QOIF (Quite OK Image Format) now supported for either images
  (FXQOIFImage) or icons (FXQOIFIcon).
- FXColor to/from FXVec3d, FXVec3f, FXVec4d, FXVec4f now using SSE if
  compiled for x86-64-v2 or higher.
- Updated byte swap APIs in fxendian.h.
- New APIs in FXMat3f, FXMat3d, etc. classes to set up mirror-matrix.
- Moved new hash32() etc. functions into fxendian.h.
- Bug fix in FXIODevice reading > 1GB files in one readBlock(),
  writeBlock() call.
- Markdown syntax coloring in Adie.
- Per-syntax mode setting for removing trailing spaces in Adie saving a
  text file.
- Subtle change in operation of FXPath::relative().
- Support for CRC32 calculations added.
- Additional conversion options in FXString::fromFloat() and
  FXString::fromDouble(): thousands groupings, force decimal point,
  and hexadecimal float output.
- FXJSON JSON loader now may report duplicate key warning reading json
  file.
- FXMappedFile improvements.
- FXString unicode escapes bug fix.
2024-08-25 08:37:06 -04:00

47 lines
2.1 KiB
C++

Emulate the behavior of the USG UNIX 'daylight' and 'timezone' variables
where not implemented.
int daylight: Zero if the time zone does not have any daylight saving time
rules and non-zero if there is a time during the year when daylight saving
time applies. [1] On FreeBSD, tzname[1] should be set to " " (three spaces)
if DST is never observed. [2]
long int timezone: contains the difference between UTC and the latest local
standard time, in seconds west of UTC. For example, in the U.S. Eastern time
zone, the value is 5*60*60. Unlike the tm_gmtoff member of the broken-down
time structure, this value is not adjusted for daylight saving, and its sign
is reversed. [1]
After [3], use the base implementations of 'daylight' and 'timezone'.
[1] https://www.gnu.org/software/libc/manual/html_node/Time-Zone-Functions.html#Time-Zone-Functions
[2] https://cgit.freebsd.org/src/tree/contrib/tzcode/stdtime/localtime.c?id=9436aa0e668b147c9a5bf1898ef091934c676434#n84
[3] https://cgit.freebsd.org/src/commit/?id=a34940a9756ac8edce36fec176949ee82e9235b4
--- lib/FXSystemTime.cpp.orig 2024-06-30 15:47:37 UTC
+++ lib/FXSystemTime.cpp
@@ -264,8 +264,11 @@ FXTime FXSystem::localTimeZoneOffset(){
setuplocaltimezone();
#if defined(WIN32)
return minutes*tzi.Bias; // +minutes*tzi.StandardBias;
-#elif defined(__FreeBSD__) || defined(__OpenBSD__)
- return 0; // FIXME
+#elif defined(__FreeBSD__) && __FreeBSD_version < 1500015 || defined (__OpenBSD__)
+ struct tm tmresult;
+ time_t tmp=time(&tmp);
+ struct tm* ptm=localtime_r(&tmp,&tmresult);
+ return seconds*(-ptm->tm_gmtoff + ptm->tm_isdst*3600);
#else
return seconds*timezone;
#endif
@@ -277,8 +280,8 @@ FXTime FXSystem::daylightSavingsOffset(){
setuplocaltimezone();
#if defined(WIN32)
return minutes*tzi.DaylightBias; // Or difference between standard and daylight bias.
-#elif defined(__FreeBSD__) || defined(__OpenBSD__)
- return 0; // FIXME
+#elif defined(__FreeBSD__) && __FreeBSD_version < 1500015 || defined (__OpenBSD__)
+ return -hours*((tzname[1][0] == ' ') ? 0 : 1);
#else
return -hours*daylight;
#endif