New built-in functions for working with unix time
-------------------------------------------------

                 Key: CORE-4406
                 URL: http://tracker.firebirdsql.org/browse/CORE-4406
             Project: Firebird Core
          Issue Type: New Feature
          Components: UDF
            Reporter: Doychin Bondzhev
            Priority: Minor


It will be great if there is a function from_unixtime that will convert unix 
time stamp in milliseconds to firebird timestamp.

This is a similar function for linux that returns string:

------------------------------
#include <stdio.h>
#include <time.h>
#include <stdlib.h>

char* from_unixtime(long long int*);

char* from_unixtime(t)
long long int *t;
{
  char* res = (char*)malloc(32);

  long milis = *t % 1000;
  long tt = *t / 1000;

  char tmp[32];
  strftime(tmp, 32, "%Y-%m-%d %H:%M:%S", localtime(&tt));

  sprintf(res, "%s:%d", tmp, milis);

  return res;
}
---------------------------------
DECLARE EXTERNAL FUNCTION FROM_UNIXTIME
    BIGINT
    RETURNS CSTRING(100) FREE_IT
    ENTRY_POINT 'from_unixtime' MODULE_NAME 'unixTime';
---------------------------------

There is similar function in MySQL.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to