Skip to content

0x007E/utils-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version: 1.0 Release Build License GPLv3

Time Utils

Ask DeepWiki

This utility can be used to validate a time/date/datetime.

File Structure

File Structure

utils/
└── time/
    ├── validate.c
    └── validate.h

core_types/
├── format/
|   └── time.h
└── return/
    └── status.h

The library is completely patform independent and can be usesd across a wide range of c-compilers.

Downloads

The library can be downloaded (zip or tar), cloned or used as submodule in a project.

Type File Description
Library zip / tar Time utility library that implements time/date/datetime validation

Using with git clone

mkdir -p ./core_types/
git clone https://github.com/0x007E/core_types-format.git ./core_types
mv ./core_types/core_types-format ./core_types/format
git clone https://github.com/0x007E/core_types-return.git ./core_types
mv ./core_types/core_types-return ./core_types/return

mkdir -p ./utils/
git clone https://github.com/0x007E/utils-time.git    ./utils
mv ./utils/utils-time ./utils/time

Using as git submodule

git submodule add https://github.com/0x007E/core_types-format.git ./core_types/format
git submodule add https://github.com/0x007E/core_types-return.git ./core_types/return
git submodule add https://github.com/0x007E/utils-time.git    ./utils/time

Programming

#include "../lib/utils/time/validate.h"

int main(void)
{
    FORMAT_Time time;
    time.hour = 10;
    time.minute = 20;
    time.second = 30;

    FORMAT_Date date;
    date.day = 10;
    date.month = 10;
    date.year = 26;

    FORMAT_DateTime datetime;
    datetime.time.hour = 10;
    datetime.time.minute = 20;
    datetime.time.second = 30;
    datetime.date.day = 10;
    datetime.date.month = 10;
    datetime.date.year = 26;


    if(validate_time(time) != RETURN_Valid)
    {
        // Error Handling
    }

    if(validate_date(date) != RETURN_Valid)
    {
        // Error Handling
    }

    if(validate_datetime(datetime) != RETURN_Valid)
    {
        // Error Handling
    }
}

R. GAECHTER