CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Library functions for ISO8601

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jsmith840101



Joined: 06 Apr 2021
Posts: 1

View user's profile Send private message

Library functions for ISO8601
PostPosted: Tue Apr 06, 2021 11:21 pm     Reply with quote

Hello,
I have been working on epoch for close to a decade but now have decided its time to move to ISO8601. Does CCS / anyone have standard libraries made for it?

Functions that I could use right away are:
epoch_to_iso8601( epoch )
iso8601_to_epoch( iso8601 )
is8601_days_difference( iso8601, iso8601 )

where iso8601 format is yyyymmdd
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Wed Apr 07, 2021 1:54 am     Reply with quote

Seriously stick with epoch internally.
It is a doddle to just print from time_t to a ISO8601 formatted output, and
similarly dead easy to parse ISO8601 to time_t. Then you have the huge
advantage of only needing 4bytes to physically store a time, versus more
than a dozen to store an ISO8601 format.
That is what most systems do internally. On Windows there are a couple
of basic libraries that do these conversions, and most software sticks to the
Unix epoch internally.
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Apr 07, 2021 4:30 am     Reply with quote

curious was i..
went to Wiki....
from the description...

The standard does not assign any specific meaning to elements of the date/time to be represented; the meaning will depend on the context of its use.

This didn't really inspire any confidence in ISO or ' standards'...... Sad

At my age in life, I don't care or need to know to the submillisecond the 'time', just happy to get up with Mr. Sun every day.... Smile
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group