func (i *IE) Timer() (time.Duration, error) {
	if len(i.Payload) < 1 {
		return 0, io.ErrUnexpectedEOF
	}
	switch i.Type {
	case Timer:
		var d time.Duration
		switch (i.Payload[0] & 0xe0) >> 5 {
		case 0x07:
			d = time.Duration(math.MaxInt64)
		case 0x04:
			d = time.Duration(i.Payload[0]&0x1f) * 10 * time.Hour
		case 0x03:
			d = time.Duration(i.Payload[0]&0x1f) * time.Hour
		case 0x02:
			d = time.Duration(i.Payload[0]&0x1f) * 10 * time.Minute
		case 0x01:
			d = time.Duration(i.Payload[0]&0x1f) * time.Minute
		case 0x00:
			d = time.Duration(i.Payload[0]&0x1f) * 2 * time.Second
		default:
			d = 0
		}
		return d, nil
	case OverloadControlInformation:
		ies, err := i.OverloadControlInformation()
		if err != nil {
			return 0, err
		}
		for _, x := range ies {
			if x.Type == Timer {
				return x.Timer()
			}
		}
		return 0, ErrIENotFound
	case GTPUPathQoSControlInformation:
		ies, err := i.GTPUPathQoSControlInformation()
		if err != nil {
			return 0, err
		}
		for _, x := range ies {
			if x.Type == Timer {
				return x.Timer()
			}
		}
		return 0, ErrIENotFound
	default:
		return 0, &InvalidTypeError{Type: i.Type}
	}
}
Timer returns Timer in time.Duration if the type of IE matches.
package ie
import (
	"io"
	"math"
	"time"
)
func NewTimer(duration time.Duration) *IE {
	var unit, value uint8
	switch {
	case duration%(10*time.Hour) == 0:
		unit = 0x80
		value = uint8(duration / (10 * time.Hour))
	case duration%(1*time.Hour) == 0:
		unit = 0x60
		value = uint8(duration / time.Hour)
	case duration%(10*time.Minute) == 0:
		unit = 0x40
		value = uint8(duration / (10 * time.Minute))
	case duration%(1*time.Minute) == 0:
		unit = 0x20
		value = uint8(duration / time.Minute)
	case duration%(2*time.Second) == 0:
		unit = 0x00
		value = uint8(duration / (2 * time.Second))
	default:
		unit = 0xe0
		value = 0
	}
	return newUint8ValIE(Timer, unit+(value&0x1f))
}