Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#
# make std/somemodule.test => only builds and unittests std.somemodule
#
# make TZ_DATABASE_DIR=path to the TZDatabase directory => This is useful to
# overwrite the hardcoded path to the TZDatabase directory needed
# for std/datetime/timezone.d

################################################################################
# Configurable stuff, usually from the command line
Expand Down Expand Up @@ -139,6 +142,11 @@ endif
ifdef ENABLE_COVERAGE
DFLAGS += -cov
endif
ifneq (,$(TZ_DATABASE_DIR))
$(file > /tmp/TZDatabaseDirFile, ${TZ_DATABASE_DIR})
DFLAGS += -version=TZDatabaseDir -J/tmp/
endif

UDFLAGS=-unittest -version=StdUnittest

# Set DOTOBJ and DOTEXE
Expand Down
11 changes: 10 additions & 1 deletion std/datetime/timezone.d
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,16 @@ public:
}


version(Android)
version(TZDatabaseDir)
{
import std.string : strip;
/++
The default directory where the TZ Database files are. It's empty
for Windows, since Windows doesn't have them.
+/
enum defaultTZDatabaseDir = strip(import("TZDatabaseDirFile"));
}
else version(Android)
{
// Android concatenates all time zone data into a single file and stores it here.
enum defaultTZDatabaseDir = "/system/usr/share/zoneinfo/";
Expand Down