Coder Social home page Coder Social logo

time's Introduction

time

A lightweight time library and datatype for Carp.

Installation

(load "[email protected]:carpentry-org/[email protected]")

Usage

This library exports two important datatypes, Datetime and Timedelta. Datetime is meant to be a low friction datatype; this means that it should be relatively easy to create, modify, and convert to other types!

Timedelta is used to add and subtract anything on the scale of seconds to weeks from those times.

(load "[email protected]:carpentry-org/[email protected]")

(defn main []
  (println*
    &(Datetime.strftime
      &(Timedelta.sub &(Datetime.now) &(Timedelta.days 2))
      "%Y-%m-%d %I:%M:%S.%n %p %z")))

You can find the API documentation online!


Have fun!

time's People

Contributors

hellerve avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

timdeve sdilts

time's Issues

Add proper timedeltas

Instead of trying to continue down the road of adding functions like add-seconds, we should probably use a proper timedelta type instead that we can add and subtract from times.

That would be the more principled abstraction and lead to better userland code.

Cheers

Add strptime

Similarly to strftime, we should support strptime. It requires a fair bit of machinery, but shouldn’t be incredibly hard.

Cheers

and* as well as or* are missing

I am not sure if and* and or* where part of a previous version of carp but they are now missing. Replacing them with and as well as or makes this compile but executing any code leads to a multitude of errors like this one.

String String_prn(const String *s) {
                                ^
out/main.c:14969:21: error: passing 'const char **' to parameter of type 'const String *'
      (aka 'char *const *') discards qualifiers in nested pointer types
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  temp = String_prn(&p->tm_zone);
                    ^~~~~~~~~~~
../carp-v0.5.5-x86_64-linux//core/carp_string.h:119:33: note: passing argument to
      parameter 's' here
String String_prn(const String *s) {

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.