{"id":18854374,"url":"https://github.com/urbanjost/m_time","last_synced_at":"2026-02-17T21:01:41.560Z","repository":{"id":62701496,"uuid":"227927567","full_name":"urbanjost/M_time","owner":"urbanjost","description":" module of procedures that expand on the Fortran DATE_AND_TIME(3f) intrinsic","archived":false,"fork":false,"pushed_at":"2025-07-20T00:42:11.000Z","size":49806,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-28T22:32:54.246Z","etag":null,"topics":["calendar","date","date-formatting","datetime","fortran","fortran-package-manager","fpm","time"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/urbanjost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-13T21:48:45.000Z","updated_at":"2025-07-20T00:37:29.000Z","dependencies_parsed_at":"2023-10-04T07:48:40.670Z","dependency_job_id":"cc6c3f02-e797-42b5-b59b-4ee60acdd0ea","html_url":"https://github.com/urbanjost/M_time","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/urbanjost/M_time","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urbanjost%2FM_time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urbanjost%2FM_time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urbanjost%2FM_time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urbanjost%2FM_time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/urbanjost","download_url":"https://codeload.github.com/urbanjost/M_time/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urbanjost%2FM_time/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29558100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T20:52:40.164Z","status":"ssl_error","status_checked_at":"2026-02-17T20:48:10.325Z","response_time":100,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calendar","date","date-formatting","datetime","fortran","fortran-package-manager","fpm","time"],"created_at":"2024-11-08T03:48:03.425Z","updated_at":"2026-02-17T21:01:41.539Z","avatar_url":"https://github.com/urbanjost.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- M_timestamp --\u003e\n[![pocketwatch](docs/images/M_time.3m_time.gif)](https://urbanjost.github.io/M_time/fpm-ford/index.html)\n# [M_time](https://urbanjost.github.io/M_time/man3.html)\n\n## Name\n   M_time - Fortran module for manipulating and presenting time and date values\n\n## Description\n\nM_time(3f) displays Civilian Calendar dates in many formats.\n\nIn addition to high-level date formatting, it can manipulate or read\nmany other date representations ...\n\n  * Julian and Modified Julian Dates\n  * Baseday and Seconds Dates\n  * Unix Epoch Dates\n  * High-level date formatting\n  * Ordinal days of the year\n  * days of the week\n  * ISO-8601 week numbers\n  * month and weekday names\n  * (limited) internationalization\n\n__Julian__ and __Unix Epoch Dates__ are particularly useful for\nmanipulating dates in simple numeric expressions. They are numbers with\nunits of days and seconds respectively from a fixed date that you can\neasily convert to and from. So you can convert any date to a Julian Date,\nsubtract one and you have the date for the day before, for example.\n\nThe `M_time Fortran` module complements the `DATE_AND_TIME(3f)` procedure\n( it is the standard Fortran intrinsic subroutine that returns the\ncurrent date and time in the Gregorian calendar). That is, the primary\nway this module represents dates is as an integer array with the same\nmeaning for elements as defined by the `DATE_AND_TIME(3f)` routine.\n\nThe extensive formatting options include showing `SYSTEM_CLOCK(3f)`\nand `CPU_USAGE(3f)` information along with Gregorian date information,\nallowing for the easy incorporation of timing information into program\nmessages.\n\nIn addition to conventional Civilian Calendar dates, the module supports\nthe ISO-8601 standard.\n\nProcedural, Functional, and OOP (Object Oriented Programming) interfaces\nare provided.\n\nEach routine is accompanied by a man(1) page which includes a sample\nprogram for that procedure. An HTML manual, the source, and example\nprograms for each procedure are included in the package.\n\n## Procedures\n\n### Epoch Time (UT starts at 0000 on 1 Jan. 1970)\n+ **[date_to_unix](https://urbanjost.github.io/M_time/date_to_unix.3m_time.html) (dat,UNIXTIME,IERR)** ! Convert date array to Unix Time\n+ **[unix_to_date](https://urbanjost.github.io/M_time/unix_to_date.3m_time.html)(unixtime,DAT,IERR)** ! Convert Unix Time to date array\n+ **[d2u](https://urbanjost.github.io/M_time/d2u.3m_time.html)(dat) result (UNIXTIME)**  ! Convert date array to Unix Time\n+ **[u2d](https://urbanjost.github.io/M_time/u2d.3m_time.html)(unixtime) result (DAT)**  ! Convert Unix Time to date array\n### Julian\n+ **[julian_to_date](https://urbanjost.github.io/M_time/julian_to_date.3m_time.html)(julian,DAT,IERR)** ! Convert Julian Date to date array\n+ **[date_to_julian](https://urbanjost.github.io/M_time/date_to_julian.3m_time.html)(dat,JULIAN,IERR)** ! Convert date array to Julian Date\n+ **[d2j](https://urbanjost.github.io/M_time/d2j.3m_time.html)(dat) result (JULIAN)**    ! Convert date array to Julian Date\n+ **[j2d](https://urbanjost.github.io/M_time/j2d.3m_time.html)(julian) result (DAT)**    ! Convert Julian Date to date array\n\n### Modified Julian\n+ **[modified_julian_to_date](https://urbanjost.github.io/M_time/modified_julian_to_date.3m_time.html)(modified_julian,DAT,IERR)** ! Convert Modified Julian Date to date array\n+ **[date_to_modified_julian](https://urbanjost.github.io/M_time/date_to_modified_julian.3m_time.html)(dat,MODIFIED_JULIAN,IERR)** ! Convert date array to Modified Julian Date\n+ **[d2m](https://urbanjost.github.io/M_time/d2m.3m_time.html)(dat) result (MODIFIED_JULIAN)**    ! Convert date array to Modified Julian Date\n+ **[m2d](https://urbanjost.github.io/M_time/m2d.3m_time.html)(modified_julian) result (DAT)**    ! Convert Modified Julian Date to date array\n\n### Baseday and Seconds\n+ **[bas_to_date](https://urbanjost.github.io/M_time/bas_to_date.3m_time.html)(bas,DAT,IERR)** ! Convert Baseday and Seconds to date array\n+ **[date_to_bas](https://urbanjost.github.io/M_time/date_to_bas.3m_time.html)(dat,bas,IERR)** ! Convert date array to Baseday and Seconds type\n+ **[d2b](https://urbanjost.github.io/M_time/d2b.3m_time.html)(dat) result (bas)**    ! Convert date array to Baseday and Seconds\n+ **[b2d](https://urbanjost.github.io/M_time/b2d.3m_time.html)(bas) result (DAT)**    ! Convert Baseday and Seconds to date array\n\n### Day of Week\n+ **[dow](https://urbanjost.github.io/M_time/dow.3m_time.html)(dat,[WEEKDAY],[DAY],IERR)** ! Convert date array to day of the week as number and name\n### Week of Year\n+ **[d2w](https://urbanjost.github.io/M_time/d2w.3m_time.html)(dat,ISO_YEAR,ISO_WEEK,ISO_WEEKDAY,ISO_NAME)** ! Calculate iso-8601 Week-numbering year date yyyy-Www-d\n+ **[w2d](https://urbanjost.github.io/M_time/w2d.3m_time.html)([iso8601_week]|[iso_year,iso_week,iso_weekday],DAT)**  ! given iso-8601 Week as numeric year, week and day_of_week, or string \"yyyy-Www-d\" calculate date as a DAT array\n### Ordinal Day\n+ **[d2o](https://urbanjost.github.io/M_time/d2o.3m_time.html)(dat) result(ORDINAL)** ! given date array return ordinal day of year, Jan 1st=1\n+ **[o2d](https://urbanjost.github.io/M_time/o2d.3m_time.html)(ordinal) result(DAT)** ! given ordinal day of year return date array, Jan 1st=1\n+ **[ordinal_to_date](https://urbanjost.github.io/M_time/ordinal_to_date.3m_time.html) (year,ordinal_day,DAT)** ! given ordinal day of year return date array, Jan 1st=1\n + **[ordinal_seconds](https://urbanjost.github.io/M_time/ordinal_seconds.3m_time.html)()** ! seconds since the beginning of current year\n### Printing Dates\n+ **[fmtdate](https://urbanjost.github.io/M_time/fmtdate.3m_time.html)(dat,format) result (TIMESTR)** ! Convert date array to string using format\n+ **[fmtdate_usage](https://urbanjost.github.io/M_time/fmtdate_usage.3m_time.html)(indent)** ! display macros recognized by fmtdate\n+ **[locale](https://urbanjost.github.io/M_time/locale.3m_time.html)(name,mths,wks,mths,short,wks_short,ierr)** ! allow substituting other strings for month and weekday names, including predefined sets for languages representable in extended ASCII.\n+ **[now](https://urbanjost.github.io/M_time/now.3m_time.html)(format) result (NOW)** ! return string representing current time given format\n+ **[box_month](https://urbanjost.github.io/M_time/box_month.3m_time.html)(dat,CALEN)** ! print specified month into character array\n### Printing Durations\n+ **[sec2days](https://urbanjost.github.io/M_time/sec2days.3m_time.html)(seconds) result (DHMS)**  ! converts seconds to string D-HH:MM:SS\n+ **[days2sec](https://urbanjost.github.io/M_time/days2sec.3m_time.html)(str) result (SECONDS)** ! converts strings like \"D-HH:MM:SS\" or \"4 days 2 hrs\" to seconds\n### Month Name\n+ **[mo2v](https://urbanjost.github.io/M_time/mo2v.3m_time.html)(month_name) result (MONTH_NUMBER)** ! given month name return month number\n+ **[v2mo](https://urbanjost.github.io/M_time/v2mo.3m_time.html)(month_number) result (MONTH_NAME)** ! given month number return month name\n+ **[mo2d](https://urbanjost.github.io/M_time/mo2d.3m_time.html)(month_name) result (DAT)**    ! given month name and year return date array for 1st day of month\n### Astrological\n+ **[easter](https://urbanjost.github.io/M_time/easter.3m_time.html)(year,dat)**    ! calculate month and day Easter falls on for given year\n+ **[moon_fullness](https://urbanjost.github.io/M_time/moon_fullness.3m_time.html)(datin) result(FULLNESS)** ! percentage of moon phase from new to full\n+ **[phase_of_moon](https://urbanjost.github.io/M_time/phase_of_moon.3m_time.html)(datin) result(PHASE)** ! return name for phase of moon for given date\n### Reading Dates\n+ **[guessdate](https://urbanjost.github.io/M_time/guessdate.3m_time.html)(anot,dat)** ! Converts a date string to a date array, in various formats\n\u003c!--\n### C Interface\n+ **[system_sleep](https://urbanjost.github.io/M_time/system_sleep.3m_time.html)(wait_seconds)**  ! Call sleep(3c)\n--\u003e\n### Convenient Constants for use with + and - Operators\n```fortran\ninteger,parameter,public   :: realtime=kind(0.0d0)           ! type for unix epoch time and julian days\n\nreal(kind=realtime),public,parameter :: dt_minute=60.0_dp     ! one minute in seconds\nreal(kind=realtime),public,parameter :: dt_hour=3600.0_dp     ! one hour in seconds\nreal(kind=realtime),public,parameter :: dt_day=86400.0_dp     ! 24:00:00 hours in seconds\nreal(kind=realtime),public,parameter :: dt_week=dt_day*7.0_dp ! one week in seconds\n```\n--\u003e\n## Example\nA simple program that formats the current time as desired, and displays\nthe built-in help text for the formatting options is as simple as\n```fortran\n      program demo_now\n      use M_time, only : now\n      implicit none\n       write(*,*)now(\"The current date is %w, %l %d, %Y %H:%m:%s %N\") ! % macros\n       write(*,*)now(\"year-month-day\") ! or, if macros not found then keywords\n       write(*,*)now(\"Y-M-D h:m:s\")    ! and if that is not found, abbreviations\n       call locale('french')\n       write(*,*)now(\"%W, %L %D, %Y %h:%m:%s \")\n       call locale('slovak')\n       write(*,*)now(\"%W, %L %D, %Y %h:%m:%s \")\n       call locale('spanish')\n       write(*,*)now(\"%W, %L %D, %Y %h:%m:%s \")\n      end program demo_now\n```\n\n```text\n    The current date is Wed, Feb 5th, 2025 8:57:07 AM\n    2025-02-05\n    2025-02-05 08:57:07\n    mercredi, février 05, 2025 08:57:07\n    streda, február 05, 2025 08:57:07\n    miércoles, febrero 05, 2025 08:57:07\n```\n\nA built-in description of the macro and keyword substitution rules\ncan be called to easily add the information to program help messages\nand documentation.\n\n```fortran\n      program builtin_macrohelp\n      use M_time, only : fmtdate_usage\n      implicit none\n      ! built-in usage descriptions can be displayed as well\n       call fmtdate_usage() ! see all formatting options\n      end program builtin_macrohelp\n```\n```text\n   Description                                        Example\n\n   Base time array:\n    1) %Y | year, yyyy                             2025\n    2) %M | month of year, 01 to 12                02\n    3) %D | day of month, 01 to 31                 19\n       %d | day of month with suffix (1st,2nd,...) 19th\n       %K | day of month in English (eg. first)    757554556\n    4) %Z | minutes from UTC                       -0300m\n       %z | -+hh:mm from UTC                       -05:00\n       %T | -+hhmm  from UTC                       -0500\n    5) %h | hours, 00 to 23                        16\n       %H | hour (1 to 12, or twelve-hour clock)   4\n       %N | midnight\u003cAM\u003c=noon; noon\u003c=PM\u003cmidnight   PM\n    6) %m | minutes, 00 to 59                      41\n    7) %s | sec, 00 to 59                          53\n    8) %x | milliseconds 000 to 999                150\n   Conversions:\n       %E | Unix Epoch time                        1740001313.1499977\n       %e | integer value of Unix Epoch time       1740001313\n       %F | Modified Julian date                   60725.904087384231\n       %f | integer value of Modified Julian Date  60725\n       %G | Baseday and Seconds                    (60725,78113.151003420353)\n       %g | Baseday seconds                        78113.151003420353\n       %J | Julian  date                           2460726.4040873959\n       %j | integer Julian Date(Julian Day)        2460726\n       %O | Ordinal day (day of year)              050\n       %o | Whole days since Unix Epoch date       20138\n       %U | day of week, 1..7 Sunday=1             4\n       %u | day of week, 1..7 Monday=1             3\n       %i | ISO week of year 1..53                 8\n       %I | iso-8601 week with weekday: yyyy-Www-d 2025-W08-3\n    Names:\n       %l | abbreviated month name                 Feb\n       %L | full month name                        February\n       %w | first three characters of weekday      Wed\n       %W | weekday name                           Wednesday\n       %p | phase of moon                          Last quarter\n       %P | percent of way from new to full moon   -54%\n       %X | day of the month in English            nineteenth\n    Literals:\n       %% | a literal %                             %\n       %t | tab character\n       %b | blank character\n       %B | exclamation(bang) character            !\n       %n | new line (system dependent)\n\n       %q | single quote (apostrophe)              '\n       %Q | double quote                           \"\n    Duration:\n       %a | Time since now as d-hh:mm:ss           0-00:00:00\n       %A | Time since now as seconds              0.0000000000000000\n    Program timing:\n       %c | CPU_TIME(3f) output                    0.45703999999999995E-1\n       %C | number of times this routine is used   1\n       %S | seconds since last use of this format  0.0000000000000000\n       %k | time in seconds from SYSTEM_CLOCK(3f)  757554.562\n       %K | time in clicks from SYSTEM_CLOCK(3f)   757554565\n    Help:\n       %? | call fmtdate_usage()\n\n   If no percent (%) is found in the format one of several\n   alternate substitutions occurs.\n\n   If the format is composed entirely of one of the following\n   keywords the following substitutions occur:\n    iso-8601,\n    iso          ==\u003e %Y-%M-%DT%h:%m:%s%z ==\u003e 2025-02-19T16:41:53-05:00\n    iso-8601W,\n    isoweek      ==\u003e %I ==\u003e 2025-W08-3\n    sql          ==\u003e %Y-%M-%D %h:%m:%s.%x ==\u003e 2025-02-19 16:41:53.158\n    sqlday       ==\u003e %Y-%M-%D ==\u003e 2025-02-19\n    sqltime      ==\u003e %h:%m:%s.%x ==\u003e 16:41:53.159\n    dash         ==\u003e %Y-%M-%D ==\u003e 2025-02-19\n    rfc-2822     ==\u003e %w, %D %l %Y %h:%m:%s %T\n                       Wed, 19 Feb 2025 16:41:53 -0500\n    rfc-3339     ==\u003e %Y-%M-%DT%h:%m:%s%z ==\u003e 2025-02-19T16:41:53-05:00\n    date         ==\u003e %w %l %D %h:%m:%s UTC%z %Y\n                       Wed Feb 19 16:41:53 UTC-05:00 2025\n    short        ==\u003e %w, %l %d, %Y %H:%m:%s %N UTC%z\n                       Wed, Feb 19th, 2025 4:41:53 PM UTC-05:00\n    long,\" \"     ==\u003e %W, %L %d, %Y %H:%m:%s %N UTC%z\n                       Wednesday, February 19th, 2025 4:41:53 PM UTC-05:00\n    suffix       ==\u003e %Y%D%M%h%m%s ==\u003e 20251902164153\n    formal       ==\u003e The %d of %L %Y ==\u003e The 19th of February 2025\n    lord         ==\u003e the %d day of %L in the year of our Lord %Y\n                       the 19th day of February in the year of our Lord 2025\n    easter       ==\u003e FOR THE YEAR OF THE CURRENT DATE:\n                       Easter day: the %d day of %L in the year of our Lord %Y\n    all          ==\u003e A SAMPLE OF DATE FORMATS\n    usage|help|? ==\u003e call fmtdate_usage\n   otherwise the following words are replaced with the most\n   common macros:\n      year                        %Y  2025\n      month                       %M  02\n      day                         %D  19\n      timezone                    %z  -05:00\n      hour                        %h  16\n      minute                      %m  41\n      second                      %s  53\n      millisecond                 %x  164\n      epoch                       %e  1740001313\n      julian                      %j  2460726\n      ordinal                     %O  050\n      weekday                     %u  3\n      longmonth|MONTH             %L  February\n      shortmonth|Month|Mth        %l  Feb\n      shortday|DAY                %d  19th\n      longday                     %X  nineteenth\n      goodhour|HOUR               %H  4\n      GOOD                        %N  PM\n      shortweekday|Weekday|wkday  %w  Wed\n      longweekday|WEEKDAY         %W  Wednesday\n      Timezone                    %Z  -0300m\n      TIMEZONE                    %z  -05:00\n      age                         %a  0-00:00:00\n      AGE                         %A  0.0000000000000000\n```\n   If none of these keywords are found then every letter that\n   is a macro is assumed to have an implied percent in front\n   of it. For example:\n```text\n      YMDhms ==\u003e %Y%M%D%h%m%s ==\u003e 20250219164153\n```\n---\n![docs](docs/images/docs.gif)\n---\n## Documentation\n\n### User\n\u003c!--\n+ [intro page](https://urbanjost.github.io/M_time/M_time.3m_time.html)\n+ [OOP intro page](https://urbanjost.github.io/M_time/M_time_oop.3m_time.html)\n--\u003e\n+ [man-page index](https://urbanjost.github.io/M_time/man3.html)\n+ [BOOK_M_time](https://urbanjost.github.io/M_time/BOOK_M_time.html) is a consolidated\n  single-page version of the man-pages for ease in printing and searching(`requires javascript`)\n\n+ Furthermore there are actual man-pages that can be installed on ULS (Unix-Like Systems):\n    - ![man-pages](docs/images/manpages.gif) [manpages.tgz](https://urbanjost.github.io/M_time/manpages.tgz)\n    - ![man-pages](docs/images/manpages.gif) [manpages.zip](https://urbanjost.github.io/M_time/manpages.zip)\n### Developer Documentation\n\n- [doxygen output](https://urbanjost.github.io/M_time/doxygen_out/html/index.html).\n- [ford output](https://urbanjost.github.io/M_time/fpm-ford/index.html).\n- [CHANGELOG](docs/CHANGELOG.md)\n---\n## Download tarball or zip file\n\n- [archive](https://github.com/urbanjost/M_time/releases) files containing released\n  versions in tar(1) and zip(1) format.\n---\n![GNU](docs/images/gnu.gif)\n---\n## Download and Build using gmake\n\nTo build the modules download the github repository, enter the src/\ndirectory and run make(1):\n```text\n     git clone https://github.com/urbanjost/M_time.git\n     cd M_time/src\n\n     make clean\n     # change Makefile if not using one of the listed compilers\n     # COMPILER_NAME={ifort, nvfortran, or gfortran}\n     make $COMPILER_NAME\n```\nThis will compile the M_time module and optionally build all the example programs from\nthe document pages (in the example/ sub-directory).\n```text\n     # optionally\n     make run  # run all the demo programs from the man-pages\n     make help # see other developer options\n```\n---\n![fpm](docs/images/fpm_logo.gif)\n---\n## Download and Build using fpm\n\nTo download the github repository and build and test it with fpm :\n```bash\n     git clone https://github.com/urbanjost/M_time.git\n     cd M_time\n     # on MSWindows:\n     fpm test -flag \"-D _WIN32\"\n     # on other platforms\n     fpm test\n```\nor just list it as a dependency in your fpm.toml project file.\n\n```toml\n     [dependencies]\n     M_time        = { git = \"https://github.com/urbanjost/M_time.git\" }\n```\n---\n![cmake](docs/images/cmake_logo-1.png)\n---\n## Download and Build using cmake\n\nTo download the github repository and build and install with cmake\n(you may wish to change the install path in src/CMakeLists.txt first) :\n```bash\n      git clone https://github.com/urbanjost/M_time.git\n      cd M_time\n\n      # Create a Build Directory:\n      mkdir -p build\n\n      cd build\n      cmake -S ../src -B .\n\n      # Configure the Build, specifying your preferred compiler (ifort, flang, etc.):\n      cmake . -DCMAKE_Fortran_COMPILER=gfortran\n\n      # Build the Project:\n      cmake --build .\n\n      #This creates:\n      #\n      #    build/lib/libM_time.a (the static library).\n      #    build/include/*.mod (module files).\n      #    build/test/* (test executables).\n      #    build/example/* (example executables).\n\n      # OPTIONAL SECTION:\n\n      # Verify build\n      ls build/lib/libM_time.a\n      ls build/include/*.mod\n      ls build/test/*\n      ls build/example/*\n\n      #Optionally Run Tests and Examples:\n      for name in ./test/* ./example/*\n      do\n         $name\n      done\n\n      #Install (Optional):\n      # This installs the library and module files to the system\n      # (e.g., /usr/local/lib/ and /usr/local/include/).\n      cmake --install .\n\n      # if you have insufficient permissions sudo(1) may be required\n      # to perform the install\n      #sudo cmake --install .\n\n      # Verify installation\n      ls /usr/local/lib/libM_time.a\n      ls /usr/local/include/*.mod\n\n      # Cleaning Up: To clean artifacts, remove the build/ directory:\n      rm -rf build\n```\n---\n![demos](docs/images/demo.gif)\n---\n## Demo Programs\n\nEach man-page contains a small sample program that has been extracted\nand placed in the [example/](example/) directory.  The small example programs\ndemonstrate how easily you can generate a variety of output formats:\n```text\n    Sun, Jan 5th, 2020 10:48:33 AM UTC-05:00\n\n    Sunday, January 5th, 2020 10:48:53 AM UTC-05:00\n\n        January 2020\n    Mo Tu We Th Fr Sa Su\n           1  2  3  4  5\n     6  7  8  9 10 11 12\n    13 14 15 16 17 18 19\n    20 21 22 23 24 25 26\n    27 28 29 30 31\n\n    Julian Date is 2458854.1545532290\n\n    Unix Epoch time is 1578238955.5700049\n\n    ISO-8601 Week: 2020-W01-7\n\n    Day of year is: 5\n\n    for year 2020 days in year is: 366\n\n    weekday=7 day=Sunday\n\n    Easter day: the 12th day of April in the year of our Lord 2020\n```\nIn particular, the example program \"now\" easily lets you try out various\noptions. With no options it displays allowed formats. For example:\n```text\n      ./now year month day\n      ./now 'julian epoch ordinal'\n      ./now 'The year is %Y and the month is %M (%L) %h:%m:%s'\n      ./now formal\n\n       20200105\n       2458854 1578240100 005\n       The year is 2020 and the month is 01 (January) 11:01:39\n       The 5th of January 2020\n```\n## Definitions\n\nA \"date_and_time\" array **\"DAT\"** has the same format as the array of\nvalues generated by the Fortran intrinsic DATE_AND_TIME(3f). That is,\nit is an 8-element integer array containing year, month, day, Time zone\ndifference from UTC in minutes, hour, minutes, seconds, and milliseconds\nof the second. This array represents a date on the Proleptic Gregorian\nCalendar.\n\nThe **Proleptic Gregorian Calendar** assumes the Gregorian Calendar\nexisted back to the beginning of the Julian Day calendar (4713 BC). This\nmeans historic dates will often be confused, as the Julian Calendar was\nused in the USA until 1752-09-03, for example. The Gregorian Calendar was\nformally decreed on 1582-10-15 but was not adapted in many countries. The\nJulian Calendar was first used around 45 BC. Note that the Proleptic\nGregorian Calendar includes a year zero (0). It is frequently used in\ncomputer software to simplify the handling of older dates. For example,\nit is the calendar used by MySQL, SQLite, PHP, CIM, Delphi, Python and\nCOBOL. The Proleptic Gregorian Calendar is explicitly required for all\ndates before 1582 by ISO 8601:2004 (clause 4.3.2.1 The Gregorian calendar)\nif the partners to information exchange agree.\n\n**Unix Epoch Time (UET)** is defined as the number of seconds since\n00:00:00 on January 1st. 1970, UTC.\n\nA **JD** is defined as a **Julian Date**. JD days start at\nnoon (not at midnight). 4713-01-01 BC at noon is defined as JD 0.0.\n\nIf you are not familiar with them, in this context Julian Dates and Unix\nEpoch Times are scalar numbers that allow for easy computations using\ndates (to go back one day just subtract one from a Julian Date, for\nexample). Since these values are generally not considered intelligible,\nroutines are included to convert between these scalar values and the\ndate array so human-readable results can be obtained.\n\n**Modified Julian Date (MJD)** measures days (and fractional days) since\nthe start of 17 Nov 1858 CE in Universal Time (UTC). Julian Date (JD)\nmeasures days (and fractional days) since noon on 1 January, 4713 BCE\nin Universal Time (UTC).\n\n    Modified Julian Date (MJD) = Julian Date (JD) - 2400000.5\n\n**Baseday and Seconds (BAS)** dates are an alternate form of the MJD\n(Modified Julian Date) where the date is stored as a structure named\n\"_BAStime_\", containing the number of days since the beginning of the MJD\nEpoch and a double representing the seconds offset from the start of\nthis day.\n```fortran\n   type BAStime\n      integer :: base_day       ! number of days since the MJD Epoch date\n      real(kind=real64) :: secs ! seconds from start of base_day\n   end type BAStime\n```\nThis allows for storing a date at a higher precision that the other\nformats used by the library, although sometimes that lower precision\nis limited primarily by the definition (ie. the milliseconds in a DAT\ncould be smaller units).\n\nBAS (and MJD) starts at midnight (00:00:00) so truncating the\nfractional component of BAS always gives the same Civil Calendar day\nwhatever the time of day (unlike JD).\n\nThe seconds offset may take any double-precision value, so that any\ndate/time may be expressed in terms of an offset from the same MJD\nday. The seconds field thus may exceed a single day, and may also be\nnegative. Note that in floating-point math larger numbers will have\na wider spacing between representable values, possibly decreasing\nthe precision of results.\n\n**Coordinated Universal Time** (French: Temps universel coordonn'\be),\nabbreviated as **UTC**, is the primary time standard by which the world\nregulates clocks and time. It is within about 1 second of mean solar\ntime at 0o longitude;[1] it does not observe daylight saving time. It\nis one of several closely related successors to Greenwich Mean Time\n(GMT). For most purposes, UTC is considered interchangeable with GMT,\nbut GMT is no longer precisely defined by the scientific community.\n\n## Limitations\n\nLike most collections of date and time procedures M_time is _not_ a\nhigh- precision library that accounts internally for leap seconds and\nrelativistic effects.\n\nM_time(3f) is intended for use in the recent era and is not appropriate\nfor use with historical dates that used some other calendar scheme such\nas the Julian Calendar. That is, you have to remember to account for\nconversions to other calendar systems when using historical dates.\n\nWhen Daylight Savings is in effect calculations will generally be correct,\nas the date model includes a timezone value; but you are responsible for\nensuring dates you create use the correct timezone value or otherwise\naccount for Daylight Savings Time as needed.\n\nCurrently, dates are manipulated using the current system timezone, which\ncan typically be set using the environment variable TZ. So if you desire\nto set the default timezone you generally set the environment variable\n_before_ executing your program. This is compatible with current observed\nbehavior for the intrinsic procedure DATE_AND_TIME(3f) with compilers I\nhave tested with, but does not seem to be a specified behavior as far as\nthe standard is concerned. That is, DATE_AND_TIME(3f) returns a vector\nthat contains a current time zone, but does not specify how a current\ntime zone can be explicitly set.  Since this library is intentionally\ndesigned to complement DATE_AND_TIME(3f) it adopts the same behavior.\n\n### Status\n+ [CD/CI STATUS](docs/STATUS.md)\n\n## See Also\n\nThe ISO-8601 standard is often used for business-related transactions.\n\nThere are (of course) the C/C++ intrinsics which provide much of the same\nfunctionality that should be bindable to Fortran via the ISO_C_BINDING\nmodule.\n\nIf you are looking for a high-precision Fortran library that is well\ntested for manipulating dates I would suggest looking at the NASA\nSPICElib library.  If you care about Leap Seconds, Orbital Mechanics,\nGPS/Satellite communications, and Astronomy it is worth a look.\n\nThe Fortran Wiki [ fortranwiki.org ](http://fortranwiki.org) contains\ninformation on other libraries and modules that provide date-time\nprocedures.\n## References\n   + [Gregorian Calendar(Wikipedia)](https://en.wikipedia.org/wiki/Gregorian_calendar)\n\u003c!--\n   TODO:\nhttp://plplot.sourceforge.net/docbook-manual/plplot-html-5.15.0/enhancement-libraries.html\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furbanjost%2Fm_time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furbanjost%2Fm_time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furbanjost%2Fm_time/lists"}