Time::EpochConverter -

# module Time::EpochConverter

## Overview

Converter to be used with `JSON.mapping` and `YAML.mapping` to serialize a `Time` instance as the number of seconds since the unix epoch. See `Time#to_unix`.

    require "json"

    class Person
      JSON.mapping({
        birth_date: {type: Time, converter: Time::EpochConverter},
      })
    end

    person = Person.from_json(%({"birth_date": 1459859781}))
    person.birth_date # => 2016-04-05 12:36:21 UTC
    person.to_json    # => %({"birth_date":1459859781})

## Defined in:

## Class Method Summary

- .from_json(value : JSON::PullParser) : Time
- .from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) : Time
- .to_json(value : Time, json : JSON::Builder)
- .to_yaml(value : Time, yaml : YAML::Nodes::Builder)

## Class Method Detail

def self.from_json(value : JSON::PullParser) : Time #
def self.from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) : Time #
def self.to_json(value : Time, json : JSON::Builder) #
def self.to_yaml(value : Time, yaml : YAML::Nodes::Builder) #