Skip to content

Commit d9cbd82

Browse files
committed
Make extra.time properties portable
1 parent c4aaea9 commit d9cbd82

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Arduino/System/BoardToolchain.cmake

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,14 @@ function (SetupBoardToolchain boards_namespace board_id generate_dir)
180180
endif()
181181
properties_set_value("ard_global" "runtime.os" "${ARDUINO_BOARD_HOST_NAME}")
182182

183-
# Set some extra properties
184-
if (${CMAKE_HOST_UNIX})
185-
execute_process(COMMAND "date" "+%s" OUTPUT_VARIABLE EPOCH)
186-
properties_set_value("ard_global" "extra.time.local" "${EPOCH}")
187-
endif()
183+
# Set extra.time.* properties
184+
string(TIMESTAMP epoch_local "%s")
185+
properties_set_value("ard_global" "extra.time.local" "${epoch_local}")
186+
string(TIMESTAMP epoch_utc "%s" UTC)
187+
properties_set_value("ard_global" "extra.time.utc" "${epoch_utc}")
188+
math(EXPR zone "${epoch_local} - ${epoch_utc}")
189+
properties_set_value("ard_global" "extra.time.zone" "${zone}")
190+
properties_set_value("ard_global" "extra.time.dst" "0") # Don't know how to get this
188191

189192
# Packager of the selected board
190193
_board_get_platform_property("/pkg_id" pkg_id)

0 commit comments

Comments
 (0)