Coder Social home page Coder Social logo

datetimeplusplus's Introduction

DateTimePlusPlus

This is a small C++ library designed to mimic the behavior of System.DateTime and System.TimeSpan from C#. It is not meant to be a precise port. Rather, the only standard is that the classes make use of the same 64-bit signed integer 'ticks' value (representing 100-nanosecond intervals since January 1, 0001).

Requirements

The project files are for the Code::Blocks IDE. See http://www.codeblocks.org/ for more information. If you want to submit other build files, submit a patch!

The DateTime and TimeSpan classes are completely self-contained and portable. They should work as is across any compiler or platform. (If they don't, submit a patch!)

On the side, there is some native code for obtaining high resolution timestamps. The Windows code makes use of the standard Win32 API. The UNIX code makes use of clock_gettime from time.h.

License

All of this code is in the public domain. Use it for whatever you like. It is strictly research for me in making good, clean time-related tools.

If you have a contribution, submit a pull request! All I ask is that you allow your contributions into the public domain as I have done. Aside from that, I just want to make these tools better and better.

datetimeplusplus's People

Contributors

thebuzzsaw avatar

Stargazers

 avatar  avatar  avatar well.james avatar lcb avatar  avatar  avatar  avatar along avatar  avatar  avatar Celestin de Villa avatar Shreyas Balakrishna avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

datetimeplusplus's Issues

Convert loop-based math to direct math calculations

The Year, Month, and Day functions in the DateTime class get the right answers, but they depend on loops to find those answers. There should be a way to arrive at the correct answer without having to loop through ever year, month and day the way I did.

Add check in DateTimePlusPlus/DateTime.cpp

    if (InRange(year, 1, 9999) &&
        InRange(month, 1, 12) && // <<<< !!!!! 
        InRange(day, 1, DaysInMonth(month, year)) &&
        InRange(hour, 0, 23) &&
        InRange(minute, 0, 59) &&
        InRange(second, 0, 59) &&
        InRange(millisecond, 0, 999) &&
        InRange(microsecond, 0, 999) &&
        InRange(ticks, 0, 9))

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.