Giter Site home page Giter Site logo

dyu / asap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mobius3/asap

0.0 3.0 0.0 1.03 MB

A C++ header-only library for creating, displaying, iterating and manipulating dates

License: MIT License

CMake 15.36% C++ 63.11% HTML 17.18% CSS 3.84% JavaScript 0.51%

asap's Introduction

The ASAP date/time library for beautiful C++ code

ASAP is a small, header-only date-time library for C++11 and beyond. It is heavily inspired by my great time using momentjs to parse and display dates. ASAP has a lot of syntatic sugar to make your code look pretty both on the inside and outside :)

All ASAP examples available online at repl.it. (main() starts at line 533)

Features

  • A date/time class to handle dates and time (duh)
  • A duration class to handle unbounded periods (e.g, asap::day(1) specifies a day)
  • A period class to handle bounded periods (e.g, asap::period(asap::now(), asap::tomorrow()))
  • Lots of syntatic sugar (e.g, auto then = asap::now() + asap::week(1))
  • Literals (e.g, auto then = asap::now() + 1_year) for seconds, minutes, hours, days, weeks, months and years
  • Broken down duration printing (e.g, asap::days(10) prints "1 week, 3 days")
  • Range-based iteration for periods:
   for (auto x: asap::now().until(asap::tomorrow()).every(1_hour)) {
        std::cout << x << std::endl;
   }

Index

  • asap::datetime class docs to learn about date/time
  • asap::duration class docs will teach you about durations and their literals
  • asap::period class docs to learn about periods and date/time iterations
  • literals.h docs has the asap::literals namespace with all ASAP literals

Using

You can either:

  • Drop the include/asap folder in your project and use it
  • Make your compiler aware of the include/asap folder and include "asap.h" in your code
  • If using CMake you can add the project subdirectory and link against it using target_link_libraries
  • Use find_package if you installed ASAP using make install or any other method
  • Download the latest release which is a single asap.h file bundled with all the classes.

License

ASAP is MIT licensed.

asap's People

Contributors

mobius3 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.