• Stars
    star
    373
  • Rank 113,935 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Date-Time utilities for ethereum contracts.

Ethereum Date and Time tools

Contract which implements utilities for working with datetime values in ethereum.

Contract Deployments:

To verify, you need to compare the code on the blockchain with the runtime code which can be gotten from solc contracts/DateTime.sol --optimize --bin-runtime.

Also you can find it already verified at https://etherscan.io/address/0x1a6184cd4c5bea62b0116de7962ee7315b7bcbce#code

DateTime struct

Internally, the following struct is used to represent date-time object.

struct DateTime {
        uint16 year;
        uint8 month;
        uint8 day;
        uint8 hour;
        uint8 minute;
        uint8 second;
        uint8 weekday;
}

API

  • isLeapYear(uint16 year) constant returns (bool)

Given an integer year value, returns whether it is a leap year.

  • parseTimestamp(uint timestamp) internal returns (DateTime dt)

Given a unix timestamp, returns the DateTime representation of it.

  • getYear(uint timestamp) constant returns (uint16)

Given a unix timestamp, returns the DateTime.year value for the timestamp.

  • getMonth(uint timestamp) constant returns (uint16)

Given a unix timestamp, returns the DateTime.month value for the timestamp.

  • getDay(uint timestamp) constant returns (uint16)

Given a unix timestamp, returns the DateTime.day value for the timestamp.

  • getHour(uint timestamp) constant returns (uint16)

Given a unix timestamp, returns the DateTime.hour value for the timestamp.

  • getMinute(uint timestamp) constant returns (uint16)

Given a unix timestamp, returns the DateTime.minute value for the timestamp.

  • getSecond(uint timestamp) constant returns (uint16)

Given a unix timestamp, returns the DateTime.second value for the timestamp.

  • getWeekday(uint timestamp) constant returns (uint8)

Given a unix timestamp, returns the DateTime.weekday value for the timestamp.

  • toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute, uint8 second) constant returns (uint timestamp)
  • toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute) constant returns (uint timestamp)
  • toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour) constant returns (uint timestamp)
  • toTimestamp(uint16 year, uint8 month, uint8 day) constant returns (uint timestamp)

Returns the unix timestamp representation for the given date and time values.

More Repositories

1

ethereum-function-signature-registry

Registry of 4byte function signatures and their human readable counterparts.
Python
210
star
2

eth-testrpc

Used for testing all maner of Ethereum JSON-RPC interactions.
Python
163
star
3

flex

Swagger schema validator
Python
149
star
4

am-i-underpaid

A simple application for a group of employees to find out their average salaries without exposing any individual salary information.
JavaScript
84
star
5

ipfs-persistence-consortium

A consortium to help persist IPFS objects until Swarm arrives
Python
73
star
6

ethereum-computation-market

A marketplace for trustless off chain computation.
Python
56
star
7

ethereum-grove

Fast, efficient, queryable storage for ethereum contracts.
Python
52
star
8

ethereum-string-utils

String utility functions for ethereum contracts
Python
41
star
9

ethereum-usd-oracle

USD oracle for ethereum
30
star
10

ethereum-uuid

UUID v4 Generation
Python
22
star
11

devcon2-token

An identity token issued at Devcon 2
Python
16
star
12

ethereum-identity

Identity platform for Ethereum
Python
14
star
13

django-emailtools

Sending emails just got more awesomer.
Python
11
star
14

ethereum-rpc-client

[DEPRECATED] You should use web3.py instead.
Python
10
star
15

ethereum-stack-depth-lib

Solidity library for checking whether the call stack can be increased by a certain amount.
Python
10
star
16

ethereum-ipc-client

DEPRECATED - Use web3.py instead.
Python
9
star
17

ethereum-gas-proxy

An ethereum library that proxies calls and repays the transaction sender their gas costs.
Python
6
star
18

ethereum-cron

Crontab parsing for ethereum contracts.
Python
6
star
19

ethereum-accounting

Basic accounting tools for ethereum contracts
Python
5
star
20

ethereum-alarm-client

Client for executing scheduled calls for the ethereum alarm clock.
Python
5
star
21

django-fallback-storage

Use multiple storage backends for django file storage
Python
4
star
22

ethereum-alarm-clock-docs

Documentation for the ethereum Alarm service.
4
star
23

Placenoun

Like placekitten.com but instead it places whatever noun you supply
Python
4
star
24

python-style-guide

A style guide for how to write python
4
star
25

ethereum-REP-insurance-multisig

Multisignature insurance contract to hold REP tokens
Python
3
star
26

ethereum-phone-number-services

Phone number based services for ethereum
Python
3
star
27

django-game-of-life

A django project to simulate conways game of life
JavaScript
3
star
28

py-parity

Python wrapper around the Parity Ethereum client
Python
3
star
29

LPD8806-wrapper

Wrapper for the LPD8806 drivers to abstract strips as a grid.
Java
3
star
30

snorse

Unicode Snowman Morse Code Translator
Python
2
star
31

ethereum-client-utils

Python
2
star
32

ethereum-alarm-governance

Democratic governance framework for Ethereum Alarm Clock related contracts.
Python
2
star
33

Intentions

An informal contract between the developer and the users of the software.
2
star
34

ethereum-resource-pool

Python
2
star
35

ethereum-contract

Python
2
star
36

ethereum-data-exchange

API for inter-contract data exchange.
Python
1
star
37

Mosy

Genetic algorithm for high dimensional nearest neighbor search
Python
1
star
38

ethereum-alarm-canary

Canary for the Ethereum Alarm Clock coal mine.
Python
1
star
39

ethereum-wallet

Wallet contract
Python
1
star
40

se-onboarding

Simple Energy Onboarding
Makefile
1
star
41

ethereum-replicator

Self replecating ethereum contract.
Python
1
star
42

speleobox

Tooling for generating paths for a speliobox
Python
1
star
43

django-unsigned-fields

Django fields for representing relationships via unsigned integers.
Python
1
star
44

perjury

Tools for content generation.
Python
1
star