Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #171 #280

Merged
merged 1 commit into from
Feb 24, 2020
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
29 changes: 14 additions & 15 deletions bin/node/runtime/build.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
// Copyright 2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.

// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Substrate is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use std::{
env, fs,
path::Path,
time::{SystemTime, UNIX_EPOCH},
};

use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSource};

fn main() {
fs::write(
&Path::new(&env::var_os("OUT_DIR").unwrap()).join("timestamp_now.rs"),
&format!(
"pub const NOW: u64 = {};",
SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() as u64,
AurevoirXavier marked this conversation as resolved.
Show resolved Hide resolved
),
)
.unwrap();

build_current_project_with_rustflags(
"wasm_binary.rs",
// TODO: update version
Expand Down
7 changes: 2 additions & 5 deletions bin/node/runtime/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ pub mod time {
use node_primitives::{BlockNumber, Moment};
use sp_staking::SessionIndex;

/// Date in Los Angeles*: 19/02/2020, 03:30:00
/// Date in Berlin* :19/02/2020, 18:30:00
/// Date in Beijing*: 19/02/2020, 17:30:00
/// Date in New York* :19/02/2020, 05:30:00
pub const GENESIS_TIME: Moment = 1_582_108_200_000;
include!(concat!(env!("OUT_DIR"), "/timestamp_now.rs"));
pub const GENESIS_TIME: Moment = NOW;

/// Since BABE is probabilistic this is the average expected block time that
/// we are targetting. Blocks will be produced at a minimum duration defined
Expand Down