Commit b5065429 authored by Artem Teslenko's avatar Artem Teslenko Committed by Krzysztof Jurewicz

Use calendar routines for timestamps

parent 83cd39fb
......@@ -14,11 +14,10 @@ PROJECT = ercoin
PROJECT_DESCRIPTION = A simple cryptocurrency using Tendermint
PROJECT_VERSION = 1.0.1
DEPS = abci_server datum dynarec elixir enacl erlsha2 gb_merkle_trees jiffy nist_beacon rational
DEPS = abci_server datum dynarec enacl erlsha2 gb_merkle_trees jiffy nist_beacon rational
dep_abci_server = git https://github.com/KrzysiekJ/abci_server.git v0.12.1
dep_datum = git https://github.com/fogfish/datum.git 3186018
dep_dynarec = git https://github.com/dieswaytoofast/dynarec.git 1f477
dep_elixir = git https://github.com/elixir-lang/elixir.git v1.7.3
dep_enacl = git https://github.com/jlouis/enacl.git f650c72b028e46dbbed35f94e33ebe1e8db5d7eb
dep_erlsha2 = git https://github.com/vinoski/erlsha2 e3434b33cfeea02609bbf877954d856d895b9e1d
dep_gb_merkle_trees = git https://github.com/KrzysiekJ/gb_merkle_trees.git 1687f8be1187cf0964e63012b175b286af69c21a
......@@ -36,8 +35,6 @@ dep_lfe = git https://github.com/rvirding/lfe 2880c8a2
dep_lfe.mk = git https://github.com/KrzysiekJ/lfe.mk 025e92038f330ae2b0cbfe170819419c70118ad8
DEP_PLUGINS = lfe.mk
NO_AUTOPATCH = elixir
# Whitespace to be used when creating files from templates.
SP = 4
......@@ -56,14 +53,6 @@ deps:: $(DEPS_DIR)/lfe/ebin/clj.beam
$(DEPS_DIR)/lfe/ebin/clj.beam:
$(verbose) PATH=$(PATH):$(DEPS_DIR)/lfe/bin lfec +debug_info -o $(DEPS_DIR)/lfe/ebin/ $(DEPS_DIR)/lfe/src/clj.lfe
ebin/$(PROJECT).app:: no-bad-mix-app-files | $(DEPS_DIR)/elixir/ebin
$(DEPS_DIR)/elixir/ebin:
$(gen_verbose) ln -s lib/elixir/ebin $(DEPS_DIR)/elixir/
no-bad-mix-app-files:
$(verbose) rm -rf $(DEPS_DIR)/elixir/lib/mix/test
filter-genesis-txs:
@$(SHELL_ERL) -pa $(SHELL_PATHS) -noshell -eval 'ercoin_genesis:filter_genesis_txs(), halt()'
......@@ -119,4 +108,4 @@ $(ERCOIN_CONFIG)/config.toml.patched: $(ERCOIN_CONFIG)/config.toml
$(verbose) mv $<.tmp $<
$(gen_verbose) touch [email protected]
.PHONY: filter-genesis-txs no-bad-mix-app-files init
.PHONY: filter-genesis-txs init
......@@ -7,7 +7,7 @@ Ercoin is a proof of stake cryptocurrency written in [Erlang](https://www.erlang
## Development installation
1. Install [Tendermint](https://tendermint.com) (version 0.33.0).
2. Install [Erlang](https://www.erlang.org) (19 is the minimum version).
2. Install [Erlang](https://www.erlang.org) (21 is the minimum version).
3. Install [libsodium](https://libsodium.org) (1.0.12 is the minimum version; when using a package manager, you may need to install a separate package containing development files).
4. Clone the Ercoin’s repository and enter the created directory.
5. `make app`
......
......@@ -30,13 +30,11 @@
-spec to_iso(timestamp()) -> binary().
to_iso(Timestamp) ->
'Elixir.DateTime':to_iso8601(
'Elixir.DateTime':'from_unix!'(Timestamp, second),
extended).
list_to_binary(calendar:system_time_to_rfc3339(Timestamp, [{offset, "Z"}])).
-spec now() -> timestamp().
now() ->
'Elixir.DateTime':to_unix('Elixir.DateTime':utc_now(), second).
erlang:system_time(second).
-spec now(any()) -> timestamp().
now(_) ->
......@@ -44,8 +42,7 @@ now(_) ->
-spec from_iso(binary()) -> timestamp().
from_iso(ISO) ->
{ok, DateTime, 0} = 'Elixir.DateTime':'from_iso8601'(ISO),
'Elixir.DateTime':to_unix(DateTime, second).
calendar:rfc3339_to_system_time(binary_to_list(ISO)).
-spec from_protobuf(#'google.protobuf.Timestamp'{}) -> timestamp().
from_protobuf(#'google.protobuf.Timestamp'{seconds=Secs}) ->
......
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