Skip to content

Commit

Permalink
feat(time): add system times
Browse files Browse the repository at this point in the history
The gettime function could not be used with os.date on Windows,
since it returned the unix epoch based time. Functions are now
separated.

- gettime still the same (undocumented, deprecated)
- unixtime return time since unix epoch (also on Windows)
- windowstime retruns time since windows epoch (also on unix)
- time returns system dependent time, usable with os.date

Also add initial ldoc based documentation setup
  • Loading branch information
Tieske committed Nov 9, 2023
1 parent d4222ce commit 1e6d859
Show file tree
Hide file tree
Showing 7 changed files with 435 additions and 30 deletions.
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# CHANGELOG

## Versioning

This library is versioned based on Semantic Versioning ([SemVer](https://semver.org/)).

#### Version scoping

The scope of what is covered by the version number excludes:

- error messages; the text of the messages can change, unless specifically documented.

#### Releasing new versions

- create a release branch
- update the changelog below
- update version and copyright-years in `./LICENSE.md` and `./src/[module-name]/init.lua` (in doc-comments
header, and in module constants)
- create a new rockspec and update the version inside the new rockspec:<br/>
`cp [module-name]-scm-1.rockspec ./rockspecs/[module-name]-X.Y.Z-1.rockspec`
- test: run `make test` and `make lint`
- clean and render the docs: run `make clean` and `make docs`
- commit the changes as `release X.Y.Z`
- push the commit, and create a release PR
- after merging tag the release commit with `X.Y.Z`
- upload to LuaRocks:<br/>
`luarocks upload ./rockspecs/[module-name]-X.Y.Z-1.rockspec --api-key=ABCDEFGH`
- test the newly created rock:<br/>
`luarocks install [module-name]`

## Version history

### Version X.Y.Z, unreleased

- a fix
- a change

### Version 0.1.0, released 01-Jan-2022

- initial release
29 changes: 15 additions & 14 deletions LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
MIT License Terms
=================
# MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
### Copyright (c) 2016-2023 Oscar Lim

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 16 additions & 0 deletions config.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
project='Lua-System'
title='Lua-System docs'
description='Platform independent system calls for Lua'

format='markdown'
use_markdown_titles = true
style="./doc_topics/"

file={'./src/', './system/'}
topics={'./doc_topics/', './LICENSE.md', './CHANGELOG.md'}
-- examples = {'./examples'}

dir='docs'
sort=true
sort_modules=true
all=false
3 changes: 3 additions & 0 deletions doc_topics/01-introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1. Introduction

A project template to remove the tedious repetitive work of creating Lua modules
291 changes: 291 additions & 0 deletions doc_topics/ldoc.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
body {
color: #47555c;
font-size: 16px;
font-family: "Open Sans", sans-serif;
margin: 0;
background: #eff4ff;
}

a:link { color: #008fee; }
a:visited { color: #008fee; }
a:hover { color: #22a7ff; }

h1 { font-size:26px; font-weight: normal; }
h2 { font-size:22px; font-weight: normal; }
h3 { font-size:18px; font-weight: normal; }
h4 { font-size:16px; font-weight: bold; }

hr {
height: 1px;
background: #c1cce4;
border: 0px;
margin: 15px 0;
}

code, tt {
font-family: monospace;
}
span.parameter {
font-family: monospace;
font-weight: bold;
color: rgb(99, 115, 131);
}
span.parameter:after {
content:":";
}
span.types:before {
content:"(";
}
span.types:after {
content:")";
}
.type {
font-weight: bold; font-style:italic
}

p.name {
font-family: "Andale Mono", monospace;
}

#navigation {
float: left;
background-color: white;
border-right: 1px solid #d3dbec;
border-bottom: 1px solid #d3dbec;

width: 14em;
vertical-align: top;
overflow: visible;
}

#navigation br {
display: none;
}

#navigation h1 {
background-color: white;
border-bottom: 1px solid #d3dbec;
padding: 15px;
margin-top: 0px;
margin-bottom: 0px;
}

#navigation h2 {
font-size: 18px;
background-color: white;
border-bottom: 1px solid #d3dbec;
padding-left: 15px;
padding-right: 15px;
padding-top: 10px;
padding-bottom: 10px;
margin-top: 30px;
margin-bottom: 0px;
}

#content h1 {
background-color: #2c3e67;
color: white;
padding: 15px;
margin: 0px;
}

#content h2 {
background-color: #6c7ea7;
color: white;
padding: 15px;
padding-top: 15px;
padding-bottom: 15px;
margin-top: 0px;
}

#content h2 a {
background-color: #6c7ea7;
color: white;
text-decoration: none;
}

#content h2 a:hover {
text-decoration: underline;
}

#content h3 {
font-style: italic;
padding-top: 15px;
padding-bottom: 4px;
margin-right: 15px;
margin-left: 15px;
margin-bottom: 5px;
border-bottom: solid 1px #bcd;
}

#content h4 {
margin-right: 15px;
margin-left: 15px;
border-bottom: solid 1px #bcd;
}

#content pre {
margin: 15px;
}

pre {
background-color: rgb(50, 55, 68);
color: white;
border-radius: 3px;
/* border: 1px solid #C0C0C0; /* silver */
padding: 15px;
overflow: auto;
font-family: "Andale Mono", monospace;
}

#content ul pre.example {
margin-left: 0px;
}

table.index {
/* border: 1px #00007f; */
}
table.index td { text-align: left; vertical-align: top; }

#navigation ul
{
font-size:1em;
list-style-type: none;
margin: 1px 1px 10px 1px;
padding-left: 20px;
}

#navigation li {
text-indent: -1em;
display: block;
margin: 3px 0px 0px 22px;
}

#navigation li li a {
margin: 0px 3px 0px -1em;
}

#content {
margin-left: 14em;
}

#content p {
padding-left: 15px;
padding-right: 15px;
}

#content table {
padding-left: 15px;
padding-right: 15px;
background-color: white;
}

#content p, #content table, #content ol, #content ul, #content dl {
max-width: 900px;
}

#about {
padding: 15px;
padding-left: 16em;
background-color: white;
border-top: 1px solid #d3dbec;
border-bottom: 1px solid #d3dbec;
}

table.module_list, table.function_list {
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
margin: 15px;
}
table.module_list td, table.function_list td {
border-width: 1px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
border: solid 1px rgb(193, 204, 228);
}
table.module_list td.name, table.function_list td.name {
background-color: white; min-width: 200px; border-right-width: 0px;
}
table.module_list td.summary, table.function_list td.summary {
background-color: white; width: 100%; border-left-width: 0px;
}

dl.function {
margin-right: 15px;
margin-left: 15px;
border-bottom: solid 1px rgb(193, 204, 228);
border-left: solid 1px rgb(193, 204, 228);
border-right: solid 1px rgb(193, 204, 228);
background-color: white;
}

dl.function dt {
color: rgb(99, 123, 188);
font-family: monospace;
border-top: solid 1px rgb(193, 204, 228);
padding: 15px;
}

dl.function dd {
margin-left: 15px;
margin-right: 15px;
margin-top: 5px;
margin-bottom: 15px;
}

#content dl.function dd h3 {
margin-top: 0px;
margin-left: 0px;
padding-left: 0px;
font-size: 16px;
color: rgb(128, 128, 128);
border-bottom: solid 1px #def;
}

#content dl.function dd ul, #content dl.function dd ol {
padding: 0px;
padding-left: 15px;
list-style-type: none;
}

ul.nowrap {
overflow:auto;
white-space:nowrap;
}

.section-description {
padding-left: 15px;
padding-right: 15px;
}

/* stop sublists from having initial vertical space */
ul ul { margin-top: 0px; }
ol ul { margin-top: 0px; }
ol ol { margin-top: 0px; }
ul ol { margin-top: 0px; }

/* make the target distinct; helps when we're navigating to a function */
a:target + * {
background-color: #FF9;
}


/* styles for prettification of source */
pre .comment { color: #bbccaa; }
pre .constant { color: #a8660d; }
pre .escape { color: #844631; }
pre .keyword { color: #ffc090; font-weight: bold; }
pre .library { color: #0e7c6b; }
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
pre .string { color: #8080ff; }
pre .number { color: #f8660d; }
pre .operator { color: #2239a8; font-weight: bold; }
pre .preprocessor, pre .prepro { color: #a33243; }
pre .global { color: #c040c0; }
pre .user-keyword { color: #800080; }
pre .prompt { color: #558817; }
pre .url { color: #272fc2; text-decoration: underline; }
3 changes: 3 additions & 0 deletions src/core.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/// Platform independent system calls for Lua.
// @module system

#include <lua.h>
#include <lauxlib.h>

Expand Down
Loading

0 comments on commit 1e6d859

Please sign in to comment.