Commit f345794e authored by Dan Baston's avatar Dan Baston

Initialize wsim.io date string on package load

Previously it was incorrectly being initialized at package install.
parent c05615d8
# Copyright (c) 2019 ISciences, LLC.
# All rights reserved.
#
# WSIM is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Calculate a time stamp on package load so that it's the same for
# each write within a loop. This prevents duplicate history
# entries.
time_loaded <- NULL
.onLoad <- function(libname, pkgname) {
time_loaded <<- Sys.time()
}
......@@ -60,11 +60,7 @@ standard_netcdf_attrs <- function(is_new, is_spatial, existing_history=NULL) {
return(ret)
}
# Calculate a time stamp on package load so that it's the same for
# each write within a loop. This prevents duplicate history
# entries.
time_loaded <- Sys.time()
date_string <- function() {
# time_loaded is defined in init.R
strftime(time_loaded, '%Y-%m-%dT%H:%M:%S%z')
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment