Reuse, not rework
Home

License Awareness



Highly Reusable Software

By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Math
Integer, Floating point, Matrix, Statistics, Boolean, ...

Processing
Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Communications
Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...


NAME

librock_ssgmtime - Parse a date/time string, storing to struct tm or time_t
#License - #Source code - #Example Use -

SYNOPSIS

#include <time.h>
#include <librock/datime.h>

int
librock_ssgmtime(
    const char librock_PTR *sptr,
    librock_STRUCT_TM *tmptr,
    librock_TIME_T *time);

DESCRIPTION

Scans strings of the following formats, with the part from HH:MM:SS optional
    MM/DD/YYYY HH:MM:SS
    MM/DD/YY HH:MM:SS
    DD MonthNAME YYYY HH:MM:SS -/+NNNN  (NNNN are digits specifing the offset from GMT)
    DD MonthNAME YYYY HH:MM:SS GMT

Two digit years less than 60 will be windowed into the range 2000-2059,
otherwise in the range 1960-1999.

Note that this does not parse the day of week.

Returns the number of characters processed.
Typical use is

#ifdef librock_TYPICAL_USE_ssgmtime
    #include <time.h>
    #include <librock/datime.h>

    time_t t;
    char *ptr = "02/20/02 01:03:44";
    ptr += librock_ssgmtime(ptr,NULL,(librock_TIME_T *)&t);
    printf("%ld\n",(long) t);

    ptr = "20 Feb 2002 02:03:44 +0100";
    ptr += librock_ssgmtime(ptr,NULL,(librock_TIME_T *)&t);
    printf("%ld\n",(long) t);

#endif

USES

    tolower
    gmtime
    librock_countbl librock_counttoch
    librock_ssdec
    librock_wordcmp
    librock_mkgmtime
    librock_ssmonth


LICENSE

  Copyright 1998-2002 Forrest J. Cavalier III, http://www.mibsoftware.com
  Licensed under BSD-ish license, NO WARRANTY. Copies must retain this block.
  License text in <librock/license/librock.txt> librock_LIDESC_HC=12440211096131f5976d36be0cddca4cd9152e45

Source Code

./text/convert/nonint/sstime.c (implementation, plus source of this manual page)

This software is part of Librock

Rapid reuse, without rework. Details
This page copyright (C) 2002-2003 Forrest J. Cavalier III, d-b-a Mib Software, Saylorsburg PA 18353, USA

Verbatim copying and distribution of this generated page is permitted in any medium provided that no changes are made.
(The source of this manual page may be covered by a more permissive license which allows modifications.)

Want to help? We welcome comments, patches. -- Need help? Request paid support.