Coder Social home page Coder Social logo

Compatibility of datetime data type about toml-f HOT 2 OPEN

toml-f avatar toml-f commented on July 19, 2024
Compatibility of datetime data type

from toml-f.

Comments (2)

milancurcic avatar milancurcic commented on July 19, 2024 1

It could be useful to include adapters to other datetimes, perhaps under a separate repo, perhaps toml-f/toml-datetime-adapters or similar. I think you should keep the main toml-f library clean and not pull in other datetime implementations. If and when there is ever an ubiquitous datetime implementation in Fortran, then you could just use that in the main toml-f library.

But showing how to do this in the toml-f docs would be a good first step IMO. For datetime-fortran, something like this (I didn't test the code, only typed it here)?

module tomlf_datetime_adapters
  use tomlf_datetime, only: toml_datetime
  use datetime_module, only: datetime
  implicit none
contains
  elemental type(datetime) function toml_datetime_to_datetime_fortran(d) result(res)
    type(toml_datetime), intent(in) :: d
    res = datetime( &
      year=d % date % year, &
      month=d % date % month, &
      day=d % date % day, &
      hour=d % time % hour, &
      minute=d % time % minute, &
      second=d % time % second, &
      millisecond=d % time % msec, &
      tz=timezone_offset_from_timezone_name(d % time % zone) ! not implemented
    )
  end function toml_datetime_to_datetime_fortran
end module tomlf_datetime_adapters

from toml-f.

milancurcic avatar milancurcic commented on July 19, 2024

I only now saw #103, looks good.

from toml-f.

Related Issues (20)

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.