Tu: a time util for golang

Related tags

Network tu
Overview

tu - Time Util package

tu is a time util for golang

go report card Go Reference MIT license

Install

go get github.com/iporsut/tu

Usage

Get datetime before or after specific datetime

import "github.com/iporsut/tu"

now := time.Date(2021, 12, 19, 20, 36, 30, 123456789, time.UTC)

tu.Tomorrow.Of(now)                           // 2021-12-20 20:36:30.123456789
tu.Yesterday.Of(now)                          // 2021-12-18 20:36:30.123456789
tu.BeginningOfDay.Of(now)                     // 2021-12-19 00:00:00
tu.EndOfDay.Of(now)                           // 2021-12-19 23:59:59.999999999
tu.BeginningOfMonth.Of(now)                   // 2021-12-01 00:00:00
tu.EndOfMonth.Of(now)                         // 2021-12-31 23:59:59.999999999
tu.BeginningOfYear.Of(now)                    // 2021-01-01 00:00:00
tu.EndOfYear.Of(now)                          // 2021-12-31 23:59:59.999999999

// Get datetime from N value duration
tu.N(2).SecondsAgo().Of(now)                  // 2021-12-19 20:36:28.123456789
tu.N(2).SecondsLater().Of(now)                // 2021-12-19 20:36:32.123456789
tu.N(2).MinutesAgo().Of(now)                  // 2021-12-19 20:34:30.123456789
tu.N(2).MinutesLater().Of(now)                // 2021-12-19 20:38:30.123456789
tu.N(2).HoursAgo().Of(now)                    // 2021-12-19 18:36:30.123456789
tu.N(2).HoursLater().Of(now)                  // 2021-12-19 22:36:30.123456789
tu.N(2).DaysAgo().Of(now)                     // 2021-12-17 20:36:30.123456789
tu.N(2).DaysLater().Of(now)                   // 2021-12-21 20:36:30.123456789
tu.N(2).MonthsAgo().Of(now)                   // 2019-10-19 20:36:30.123456789
tu.N(2).MonthsLater().Of(now)                 // 2022-02-19 20:36:30.123456789
tu.N(2).YearsAgo().Of(now)                    // 2019-12-19 20:36:30.123456789
tu.N(2).YearsLater().Of(now)                  // 2023-12-19 20:36:30.123456789

// Compose Time Function
tu.Tomorrow.Tomorrow().Of(now)                // 2021-12-21 20:36:30.123456789
tu.Yesterday.Yesterday().Of(now)              // 2021-12-17 20:36:30.123456789
tu.N(2).DaysAgo().BeginningOfDay().Of(now)    // 2021-12-17 00:00:00

Author

Weerasak Chongnguluam

License

Released under the MIT License.

Owner
Weerasak Chongnguluam
Weerasak Chongnguluam
Magic util that "bridges" Wireguard with OpenVPN without a TUN/TAP interface

wg-ovpn Magic util that "bridges" Wireguard with OpenVPN without a TUN/TAP interface Warning: really ugly and unstable code! Building Obtain latest so

Patrycja 6 Jan 18, 2022
An util to bypass clash-premium tun for commands

without-clash An util to bypass clash-premium tun for commands Requirement Kernel Features: cgroup2 ebpf && cgroup2 sock attach point iproute2 Install

Kr328 11 Jun 4, 2022
Ephemeral One Time/Build-Time gRPC TLS PKI system.

PkiSauce Ephemeral Build Time TLS PKI saucing for your intra services GRPC (or not) communications. Description A simple attempt to avoid deploying co

Ermites.IO 5 Jun 17, 2022
Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes.

DNS-Updater Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes. Motivation Havin

42_atomys 9 Mar 10, 2022
A Realtime API Gateway used with NATS to build REST, real time, and RPC APIs, where all your clients are synchronized seamlessly.

Realtime API Gateway Synchronize Your Clients Visit Resgate.io for guides, live demos, and resources. Resgate is a Go project implementing a realtime

Resgate.io - Synchronize Your Clients 578 Jun 29, 2022
Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator

Trickster is an HTTP reverse proxy/cache for http applications and a dashboard query accelerator for time series databases. Learn more below, and chec

null 1.7k Jun 22, 2022
Generate HTTP load and plot the results in real-time

ali A load testing tool capable of performing real-time analysis, inspired by vegeta and jplot. ali comes with an embedded terminal-based UI where you

Ryo Nakao 3.2k Jun 25, 2022
Real-time HTTP Intrusion Detection

teler Real-time HTTP Intrusion Detection Contribute · What's new · Report Bug · Request Feature teler is an real-time intrusion detection and threat a

Kitabisa 1.7k Jun 20, 2022
A LoRaWAN nodes' and network simulator that works with a real LoRaWAN environment (such as Chirpstack) and equipped with a web interface for real-time interaction.

LWN Simulator A LoRaWAN nodes' simulator to simulate a LoRaWAN Network. Table of Contents General Info Requirements Installation General Info LWN Simu

ARSLab 25 Jun 25, 2022
Application written in Go which polls Time-series data at specific intervals and saves to persistent storage

TPoller Server Overview The purpose of this application is to poll time-series data per time interval from any (telemetry) application running a gRPC

Bartlomiej Mika 4 Feb 10, 2022
Fast time-series data storage server accessible over gRPC

tstorage-server Persistent fast time-series data storage server accessible over gRPC. tstorage-server is lightweight local on-disk storage engine serv

Bartlomiej Mika 5 Oct 12, 2021
Walrus 🕑 Real-time event streaming platform built on top of gRPC streams

Walrus ?? Real-time event streaming platform built on top of gRPC streams Table of Contents About the project Built With How it works Getting Started

Matheus Mosca 13 Feb 14, 2022
the pluto is a gateway new time, high performance, high stable, high availability, easy to use

pluto the pluto is a gateway new time, high performance, high stable, high availability, easy to use Acknowledgments thanks nbio for providing low lev

mobus 2 Sep 19, 2021
Used gRPC for the first time, and it was a amazing developer experience

gRPC Used gRPC for the first time, and it was a amazing developer experience. Edge points of using gPRC which I felt: Structured Code Uniform request

Mrigank Anand 5 Oct 11, 2021
Schema-free, document-oriented streaming database that optimized for monitoring network traffic in real-time

Basenine Schema-free, document-oriented streaming database that optimized for monitoring network traffic in real-time. Featured Aspects Has the fastes

UP9 35 Jun 12, 2022
Secure Time Sync Daemon

stsd - Secure Time Sync Daemon ============================== Set system date based on HTTP 'date' headers over TLS. Inspired by Whonix's sdwdate, an

null 1 Dec 15, 2021
The repository provides supplementary Go time packages

Go Time This repository provides supplementary Go time packages. Download/Install The easiest way to install is to run go get -u golang.org/x/time. Yo

molior 0 Nov 23, 2021
PinGo is a standalone and feature-rich tool for common IP-based reachability checking tasks. Ping or Trace and Observe in real-time the statistics.

pingo As a network champion from designing and implementing to troubleshooting large scale networks - I know that is usually not easy for administrato

Jerome Amon 2 May 21, 2022
Lightweight http response time based load balancer written in Go

HTTP Load Balancer Specifications http servers should always return time taken to proceed request in headers as EXECUTION_TIME in ms this load balance

Gaëtan 0 Feb 22, 2022