// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.oer.its.ieee1609dot2.basetypes;

import java.util.Date;
import org.bouncycastle.asn1.ASN1Integer;
import java.math.BigInteger;

public class Time32 extends UINT32
{
    public static long etsiEpochMillis;
    
    public Time32(final long n) {
        super(n);
    }
    
    public Time32(final BigInteger bigInteger) {
        super(bigInteger);
    }
    
    public Time32(final UINT32 uint32) {
        this(uint32.getValue());
    }
    
    public static Time32 now() {
        return ofUnixMillis(System.currentTimeMillis());
    }
    
    public static Time32 ofUnixMillis(final long n) {
        return new Time32((n - Time32.etsiEpochMillis) / 1000L);
    }
    
    public static Time32 getInstance(final Object o) {
        if (o instanceof UINT32) {
            return new Time32((UINT32)o);
        }
        if (o != null) {
            return new Time32(ASN1Integer.getInstance(o).getValue());
        }
        return null;
    }
    
    public long toUnixMillis() {
        return this.getValue().longValue() * 1000L + Time32.etsiEpochMillis;
    }
    
    @Override
    public String toString() {
        return new Date(this.toUnixMillis()).toString();
    }
    
    static {
        Time32.etsiEpochMillis = 1072915200000L;
    }
}
