help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Time conversion functions


From: Harley Mackenzie
Subject: Re: [Help-glpk] Time conversion functions
Date: Tue, 18 Nov 2008 10:20:58 +0300

Fantastic idea - We also develop scheduling solutions and I have 
considered this implementation myself (and ODBC which you have already 
done) but never had the opportunity to implement it.

Well done.

Regards,

Harley Mackenzie

xypron wrote:
> Hello Andrew,
>
> currently I am using GLPK mainly for scheduling problems. Here the data
> often contains references to time. The GMPL language does not provide any
> functions to convert timestamps to numbers and numbers back to timestamps.
>
> I propose to add the following functions:
>
> now() returns the number of seconds since 1970
> Knowing the current time is useful as scheduling should not place production
> in the past.
>
> str2time( str, fmt ) converts a timestamp str given in format fmt to number
> of seconds since 1970
> e.g. str2time( "2008-11-15T13:22:10+0300", "%Y-%m-%dT%H:%M:%S%z");
> The time formats of RFC 3339 should be supported (a subset of ISO 8601).
> The format strings should be a subset of those used by the strptime()
> function in library GLIBC.
> Conversion of non local time will have to rely on availability of either
> function timegm() (or _mkgmtime for Microsoft Visual C) or structure element
> tm->tm_gmtoff.
>
> localtime( num, fmt ) converts a number to a timestamp in local time
> e.g. localtime( now(), "%Y-%m-%dT%H:%M:%S%")
> a possible output would be 
> 2008-11-15T17:22:10
> The format strings should be those used by the strftime() function in C99.
>
> gmtime( num, fmt ) converts a number to a timestamp in global time
> e.g. gmtime( now(), "%Y-%m-%dT%H:%M:%S%Z")
> a possibel output would be
> 2008-11-15T16:22:10
> The format strings should be those used by the strftime() function in C99.
>
> I have implemented the necessary changes to glpk-4.33 which can be found at 
> http://glpk.dyndns.org/viewvc/svn/glpk/glpk/branches/glpk-4.33-strdate/
> http://glpk.dyndns.org/viewvc/svn/glpk/glpk/branches/glpk-4.33-strdate/ 
>
> new files are:
> include/glptime.h
> src/glptime.c
>
> changed files are:
> configure.ac
> config.h.in
> include/glpmpl.h
> src/Makefile.am
> src/glpmpl01.c
> src/glpmpl03.c
> w32/Makefile*
> w32/config_VC9
> w64/Makefile*
> w64/config_VC9
>
> Best regards
>
> Xypron
>
>   

-- 
------------------------------------------------------------------
     Dr. Harley Mackenzie         ABN:   36 348 783 012

     HARD Software                Web:   www.hardsoftware.com
     PO BOX 8004                  Tel:   +61 3 5222 3435
     Newtown 3220, Australia      Email: address@hidden
------------------------------------------------------------------








reply via email to

[Prev in Thread] Current Thread [Next in Thread]