Commit be9063fb authored by filatov's avatar filatov
Browse files

Integrate the STF507 results to the trunk

parents d2f64f6e f5926bea
......@@ -19,7 +19,7 @@
"key": "_expectedResults",
"origin": "127db487-37ce-4029-998c-5d6d4f3fd06b",
"type": "STRING",
"value": "with {\r\n\tthe IUT being in the 'authorized' state\r\n\tand the IUT is configured to send more than one CAM per second\r\n\tand the IUT having sent last CAM\r\n\t\tcontaining header_fields['signer_info'].signer.type\r\n\t\t\tindicating 'certificate'\r\n}\r\nensure that {\r\n\twhen {\r\n\t\tthe IUT is requested to send next CAM\r\n\t} then {\r\n\t\tthe IUT sends a SecuredMessage\r\n\t\t\tcontaining header_fields ['signer_info'] {\r\n\t\t\t\tcontaining signer {\r\n\t\t\t\t\tcontaining type\r\n\t\t\t\t\t\tindicating 'certificate_digest_with_sha256'\r\n\t\t\t\t\tcontaining digest\r\n\t\t\t\t\t\treferencing the certificate\r\n\t\t\t\t\t\t\tcontaining subject_info.subject_type\r\n\t\t\t\t\t\t\t\tindicating 'authorization_ticket'\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t}\r\n}"
"value": "with\r\n\tthe IUT being in the 'authorized' state\r\n\tand the IUT is configured to send more than one CAM per second\r\n\tand the IUT having sent last CAM\r\n\t\tcontaining header_fields['signer_info'].signer.type\r\n\t\t\tindicating 'certificate'\r\nensure that\r\n\twhen\r\n\t\tthe IUT is requested to send next CAM\r\n\tthen\r\n\t\tthe IUT sends a SecuredMessage\r\n\t\t\tcontaining header_fields ['signer_info']\r\n\t\t\t\tcontaining signer\r\n\t\t\t\t\tcontaining type\r\n\t\t\t\t\t\tindicating 'certificate_digest_with_sha256'\r\n\t\t\t\t\tand containing digest\r\n\t\t\t\t\t\treferencing the certificate\r\n\t\t\t\t\t\t\tcontaining subject_info.subject_type\r\n\t\t\t\t\t\t\t\tindicating 'authorization_ticket'"
},
"_status": {
"isGenerated": false,
......
......@@ -19,7 +19,7 @@
"key": "_expectedResults",
"origin": "c76d35c5-5549-4ed5-b383-6b8b2218e596",
"type": "STRING",
"value": "with {\r\n\tthe IUT being in the 'authorized' state\r\n\tthe IUT being requested to include certificate in the next CAM\r\n}\r\nensure that {\r\n\twhen {\r\n\t\tthe IUT is requested to send a next CAM\r\n\t} then {\r\n\t\tthe IUT sends a SecuredMessage\r\n\t\t\tcontaining header_fields ['signer_info'] {\r\n\t\t\t\tcontaining signer {\r\n\t\t\t\t\tcontaining type\r\n\t\t\t\t\t\tindicating 'certificate'\r\n\t\t\t\t\tcontaining certificate\r\n\t\t\t\t\t\tcontaining subject_info.subject_type\r\n\t\t\t\t\t\t\tindicating 'authorization_ticket'\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t}\r\n}"
"value": "with\r\n\tthe IUT being in the 'authorized' state\r\n\tthe IUT being requested to include certificate in the next CAM\r\nensure that\r\n\twhen\r\n\t\tthe IUT is requested to send a next CAM\r\n\tthen\r\n\t\tthe IUT sends a SecuredMessage\r\n\t\t\tcontaining header_fields ['signer_info']\r\n\t\t\t\tcontaining signer\r\n\t\t\t\t\tcontaining type\r\n\t\t\t\t\t\tindicating 'certificate'\r\n\t\t\t\t\tand containing certificate\r\n\t\t\t\t\t\tcontaining subject_info.subject_type\r\n\t\t\t\t\t\t\tindicating 'authorization_ticket'"
},
"_status": {
"isGenerated": false,
......
......@@ -19,7 +19,7 @@
"key": "_expectedResults",
"origin": "fe261037-3291-4dbb-9ed6-ae425f88edc5",
"type": "STRING",
"value": "with {\r\n\tthe IUT being in the 'authorized' state\r\n}\r\nensure that {\r\n\twhen {\r\n\t\tthe IUT is requested to send a CAM\r\n\t} then {\r\n\t\tthe IUT sends a SecuredMessage {\r\n\t\t\tcontaining header_fields ['its_aid']\r\n\t\t\t\tcontaining its_aid\r\n\t\t\t\t\tindicating 'AID_CAM'\r\n\t\t\tand containing trailer_fields['signature']\r\n\t\t\t\tcontaining signature.ecdsa_signature\r\n\t\t\t\t\tcontaining R.type\r\n\t\t\t\t\t\tindicating compressed_lsb_y_0\r\n\t\t\t\t\t\tor indicating compressed_lsb_y_1 \r\n\t\t\t\t\t\tor indicating x_coordinate_only\r\n\t\t}\r\n\t}\r\n}"
"value": "with\r\n\tthe IUT being in the 'authorized' state\r\nensure that\r\n\twhen\r\n\t\tthe IUT is requested to send a CAM\r\n\tthen\r\n\t\tthe IUT sends a SecuredMessage\r\n\t\t\tcontaining header_fields ['its_aid']\r\n\t\t\t\tcontaining its_aid\r\n\t\t\t\t\tindicating 'AID_CAM'\r\n\t\t\tand containing trailer_fields['signature']\r\n\t\t\t\tcontaining signature.ecdsa_signature\r\n\t\t\t\t\tcontaining R.type\r\n\t\t\t\t\t\tindicating 'compressed_lsb_y_0'\r\n\t\t\t\t\t\tor indicating 'compressed_lsb_y_1'\r\n\t\t\t\t\t\tor indicating 'x_coordinate_only'"
},
"_status": {
"isGenerated": false,
......
......@@ -74,6 +74,42 @@
</Values:charstring>
</value>
</parameter>
<parameter id="GnssScenarioSupport" value="${LibItsCommon_Pixits.PICS_GNSS_SCENARIO_SUPPORT}"/>
<parameter id="GnssControllerAddress">
<value>
<Values:charstring xmlns:Values="Values.xsd" type="charstring">
<Values:value>10.73.224.145</Values:value>
</Values:charstring>
</value>
</parameter>
<parameter id="GnssScenario_StaticPos">
<value>
<Values:charstring xmlns:Values="Values.xsd" type="charstring">
<Values:value>C:\Program Files (x86)\Spirent Communications\Positioning Application\Scenarios\C2C\StaticPos\StaticPos.scn</Values:value>
</Values:charstring>
</value>
</parameter>
<parameter id="GnssScenario_DynamicPos200m">
<value>
<Values:charstring xmlns:Values="Values.xsd" type="charstring">
<Values:value>C:\Program Files (x86)\Spirent Communications\Positioning Application\Scenarios\C2C\DynamicPos1000m\DynamicPos200m.scn</Values:value>
</Values:charstring>
</value>
</parameter>
<parameter id="GnssScenario_DynamicPos1000m">
<value>
<Values:charstring xmlns:Values="Values.xsd" type="charstring">
<Values:value>C:\Program Files (x86)\Spirent Communications\Positioning Application\Scenarios\C2C\DynamicPos1000m\DynamicPos1000m.scn</Values:value>
</Values:charstring>
</value>
</parameter>
<parameter id="GnssScenario_DynamicPos1500m">
<value>
<Values:charstring xmlns:Values="Values.xsd" type="charstring">
<Values:value>C:\Program Files (x86)\Spirent Communications\Positioning Application\Scenarios\C2C\DynamicPos1500m\DynamicPos1500m.scn</Values:value>
</Values:charstring>
</value>
</parameter>
</parameter>
<parameter id="default" value="true"/>
</port>
......
......@@ -21,7 +21,7 @@
#include "../cshared/copts.h"
#include "../cshared/cserialize.h"
#include "../cxml/cxml.h"
#include "../generator/mkgmtime.h"
#include "mkgmtime.h"
static size_t load_certificate(const char * path, char ** p);
static EC_KEY * load_public_key(const char* path, const EC_GROUP * group);
......@@ -49,7 +49,8 @@ typedef enum {
si_digest,
si_certificate,
si_certificate_chain,
si_digest_with_other_algorithm
si_digest_with_other_algorithm,
si_other
} SignerInfoType;
typedef enum {
......@@ -117,7 +118,8 @@ static const char * _signer_types[] = {
"self",
"digest",
"certificate",
"chain",
"certificate_chain",
"other_digest",
"other",
};
......@@ -169,13 +171,13 @@ char * _es_bufs[8][64];
int _es_bufs_idx = 0;
static const char * _enumstring(int value, const char ** names, int nsize)
{
const char * ret;
char * ret;
if (!_numeric && value >= 0 && value < nsize && names[value]){
return names[value];
}
ret = _es_bufs[(++_es_bufs_idx) & 7];
ret = (char*)_es_bufs[(++_es_bufs_idx) & 7];
sprintf(ret, "%d", value);
return ret;
return (const char*)ret;
}
#define ENUMSTRING(V,L) _enumstring(V, L, sizeof(L)/sizeof(L[0]))
......@@ -187,10 +189,10 @@ static int EccPoint_Size(const EccPoint * p){
static void EccPoint_Print(FILE * f, const char * prefix, const EccPoint * const p)
{
fprintf(f, "%s<ecc_point type=\"%s\">\n%s\t", prefix, ENUMSTRING(p->type, _point_types), prefix);
print_x(f, p->x, 32);
print_x(f, (const char*)p->x, 32);
if (p->type == 4){
fprintf(f, "\n%s\t", prefix);
print_x(f, p->y, 32);
print_x(f, (const char*)p->y, 32);
}
fprintf(f, "\n%s</ecc_point>\n", prefix);
}
......@@ -240,7 +242,7 @@ int main(int argc, char ** argv)
}
if (_xmlOutput){
int length;
uint32_t length;
char digest[8];
const char * p = cert;
const char * e = cert + certlen;
......@@ -252,19 +254,34 @@ int main(int argc, char ** argv)
cxml_handler_add_default_entities(NULL);
if (*p > 1){
fprintf(stderr, "Unsupported signer type: %s\n", ENUMSTRING(*p, _signer_types));
return -1;
}
fprintf(stdout, "\t<signer type =\"%s\"", ENUMSTRING(*p, _signer_types));
if (*p == 1){
if (*p == si_digest || *p == si_digest_with_other_algorithm){
if (*p == si_digest_with_other_algorithm){
p++;
fprintf(stdout, " algorithm =\"%s\"", ENUMSTRING(*p, _pk_algorithms));
}
p++;
fprintf(stdout, " digest=\"");
print_x(stdout, p + 1, 8);
print_x(stdout, p, 8);
fprintf(stdout, "\"");
p += 8;
}
fprintf(stdout, "/>\n");
p++;
}
else{
fprintf(stdout, ">\n");
if (*p == si_certificate_chain || *p >= si_other){
const char * b = ++p;
length = (uint32_t)cintx_read(&p, e, NULL);
print_x(stdout, b, length);
p += length;
}
else{
fprintf(stderr, "Unsupported signer type: %d\n", ENUMSTRING(*p, _signer_types));
return -1;
}
fprintf(stdout, "\t</signer>\n");
}
const SubjectInfo * si = (const SubjectInfo *)p;
if (si->subject_type > crl_signer){
fprintf(stderr, "Unsupported subject type: %d\n", si->subject_type);
......@@ -278,11 +295,11 @@ int main(int argc, char ** argv)
}
fprintf(stdout, ">\n");
p += 2 + si->name_length;
length = cintx_read(&p, e, NULL);
length = (uint32_t)cintx_read(&p, e, NULL);
print_attributes(&p, p + length);
fprintf(stdout, "\t</subject>\n");
length = cintx_read(&p, e, NULL);
length = (uint32_t)cintx_read(&p, e, NULL);
fprintf(stdout, "\t<validity>\n");
print_validity(&p, p + length);
fprintf(stdout, "\t</validity>\n");
......@@ -390,7 +407,7 @@ static size_t load_certificate(const char * path, char ** p)
}
if (cert[0] != 2) {
// try hexadecimal
int i;
size_t i;
for (i = 0; i < size; i++){
char ch1 = cert[i];
if (ch1 < '0'
......@@ -513,9 +530,10 @@ static void calculate_certificate_digest(const char* data, int length, char
static void print_x(FILE * f, const char * ptr, int len)
{
const unsigned char * e = (const unsigned char *)(ptr + len);
for (; ptr < e; ptr++){
unsigned char c = *ptr;
const unsigned char * p = (const unsigned char *)ptr;
const unsigned char * e = p + len;
for (; p < e; p++){
unsigned char c = *p;
fprintf(f, "%02X", c);
}
}
......@@ -528,7 +546,7 @@ static int print_attributes(const char ** pp, const char * e)
int rc = 0;
const char * p = *pp;
unsigned char atype;
int length;
uint32_t length;
while (rc == 0 && p < e){
const PublicKey * key;
const EccPoint * point;
......@@ -577,11 +595,11 @@ static int print_attributes(const char ** pp, const char * e)
p += EccPoint_Size(point);
break;
case its_aid_list:
length = cintx_read(&p, e, NULL);
length = (uint32_t)cintx_read(&p, e, NULL);
rc = print_aid_list(&p, p + length);
break;
case its_aid_ssp_list:
length = cintx_read(&p, e, NULL);
length = (uint32_t)cintx_read(&p, e, NULL);
rc = print_aid_ssp_list(&p, p + length);
break;
default:
......@@ -600,7 +618,7 @@ static int print_aid_list(const char ** pp, const char * e)
int rc = 0;
const char *p = *pp;
while (rc == 0 && p < e){
int n = cintx_read(&p, e, &rc);
uint32_t n = (uint32_t)cintx_read(&p, e, &rc);
fprintf(stdout, "\t\t\t<aid value=\"%d\"/>\n", n);
}
*pp = e;
......@@ -613,8 +631,8 @@ static int print_aid_ssp_list(const char ** pp, const char * e)
const char *p = *pp;
while (rc == 0 && p < e){
char * data;
int n = cintx_read(&p, e, &rc);
int len = cintx_read(&p, e, &rc);
uint32_t n = (uint32_t)cintx_read(&p, e, &rc);
uint32_t len = (uint32_t)cintx_read(&p, e, &rc);
fprintf(stdout, "\t\t\t<ssp aid=\"%d\"/>", n);
if (len){
int r = cxml_text_encode(NULL, &data, p, len);
......@@ -726,7 +744,7 @@ static int print_validity(const char ** pp, const char * e)
if (rc == 0){
uint16_t id = cint16_read(&p, e, &rc);
if (rc == 0){
int local = cintx_read(&p, e, &rc);
uint32_t local = (uint32_t)cintx_read(&p, e, &rc);
if (rc == 0){
fprintf(stdout, "\t\t\t<id dictionary=\"%s\" id=\"%u\" local=\"%u\"/>\n",
ENUMSTRING(dict, _id_region_dicts), id, local);
......@@ -735,6 +753,15 @@ static int print_validity(const char ** pp, const char * e)
}
}
break;
default:
{
fprintf(stdout, "\t\t\t<region type=\"%d\">\n", rtype);
int size = (int)cintx_read(&p, e, &rc);
print_x(stdout, p, size); p += size;
fprintf(stdout, "\n\t\t\t</region>\n");
}
break;
}
}
fprintf(stdout, "\t\t</restriction>\n");
......
......@@ -36,14 +36,14 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
......@@ -72,12 +72,12 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\OpenSSL-Win32\include;..</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\OpenSSL\Win32\include;..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\OpenSSL-Win32\lib\VC\static</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\OpenSSL\Win32\lib\VC\static</AdditionalLibraryDirectories>
<AdditionalDependencies>libeay32MDd.lib;ssleay32MDd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
......@@ -90,14 +90,14 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\OpenSSL-Win32\include;..</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\OpenSSL\Win32\include;..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>C:\OpenSSL-Win32\lib\VC\static</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\OpenSSL\Win32\lib\VC\static</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
......
// Found in DeSmuME
// Alexis modified it a tad bit so it would compile as C (opposed to C++)
/* lib/mkgmtime.c
Copyright (C) 2010 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
//Taken from newlib 1.18.0 which is licensed under GPL 2 and modified for desmume
/*
* mktime.c
* Original Author: G. Haley
*
* Converts the broken-down time, expressed as local time, in the structure
* pointed to by tim_p into a calendar time value. The original values of the
* tm_wday and tm_yday fields of the structure are ignored, and the original
* values of the other fields have no restrictions. On successful completion
* the fields of the structure are set to represent the specified calendar
* time. Returns the specified calendar time. If the calendar time can not be
* represented, returns the value (time_t) -1.
*
* Modifications: Fixed tm_isdst usage - 27 August 2008 Craig Howland.
*/
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include "mkgmtime.h"
#define _SEC_IN_MINUTE 60L
#define _SEC_IN_HOUR 3600L
#define _SEC_IN_DAY 86400L
static const int DAYS_IN_MONTH[12] =
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
#define _DAYS_IN_MONTH(x) ((x == 1) ? days_in_feb : DAYS_IN_MONTH[x])
static const int _DAYS_BEFORE_MONTH[12] =
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
#define _ISLEAP(y) (((y) % 4) == 0 && (((y) % 100) != 0 || (((y)+1900) % 400) == 0))
#define _DAYS_IN_YEAR(year) (_ISLEAP(year) ? 366 : 365)
static void validate_structure(struct tm *tim_p)
{
div_t res;
int days_in_feb = 28;
/* calculate time & date to account for out of range values */
if (tim_p->tm_sec < 0 || tim_p->tm_sec > 59)
{
res = div (tim_p->tm_sec, 60);
tim_p->tm_min += res.quot;
if ((tim_p->tm_sec = res.rem) < 0)
{
tim_p->tm_sec += 60;
--tim_p->tm_min;
}
}
if (tim_p->tm_min < 0 || tim_p->tm_min > 59)
{
res = div (tim_p->tm_min, 60);
tim_p->tm_hour += res.quot;
if ((tim_p->tm_min = res.rem) < 0)
{
tim_p->tm_min += 60;
--tim_p->tm_hour;
}
}
if (tim_p->tm_hour < 0 || tim_p->tm_hour > 23)
{
res = div (tim_p->tm_hour, 24);
tim_p->tm_mday += res.quot;
if ((tim_p->tm_hour = res.rem) < 0)
{
tim_p->tm_hour += 24;
--tim_p->tm_mday;
}
}
if (tim_p->tm_mon > 11)
{
res = div (tim_p->tm_mon, 12);
tim_p->tm_year += res.quot;
if ((tim_p->tm_mon = res.rem) < 0)
{
tim_p->tm_mon += 12;
--tim_p->tm_year;
}
}
if (_DAYS_IN_YEAR (tim_p->tm_year) == 366)
days_in_feb = 29;
if (tim_p->tm_mday <= 0)
{
while (tim_p->tm_mday <= 0)
{
if (--tim_p->tm_mon == -1)
{
tim_p->tm_year--;
tim_p->tm_mon = 11;
days_in_feb =
((_DAYS_IN_YEAR (tim_p->tm_year) == 366) ?
29 : 28);
}
tim_p->tm_mday += _DAYS_IN_MONTH (tim_p->tm_mon);
}
}
else
{
while (tim_p->tm_mday > _DAYS_IN_MONTH (tim_p->tm_mon))
{
tim_p->tm_mday -= _DAYS_IN_MONTH (tim_p->tm_mon);
if (++tim_p->tm_mon == 12)
{
tim_p->tm_year++;
tim_p->tm_mon = 0;
days_in_feb =
((_DAYS_IN_YEAR (tim_p->tm_year) == 366) ?
29 : 28);
}
}
}
}
static const unsigned long _leap_moments[] = {
1136073600,
1230768000,
1341100800,
1435708800,
};
time_t addleapseconds(time_t t)
{
int i;
for (i = 0; i < sizeof(_leap_moments) / sizeof(_leap_moments[0]); i++){
if (t < _leap_moments[i]) break;
}
return t + i;
}
time_t removeleapseconds(time_t t)
{
int i;
for (i = 0; i < sizeof(_leap_moments) / sizeof(_leap_moments[0]); i++){
if (t < _leap_moments[i]) break;
t--;
}
return t;
}
#define ITS_UTC_EPOCH 1072915200
unsigned long mkitstime32(struct tm *tim_p)
{
time_t ret = mktaitime(tim_p);
if (ret > 0){
ret -= ITS_UTC_EPOCH;
}
return (unsigned long)ret;
}
unsigned long long mkitstime64(struct tm *tim_p)
{
unsigned long long ret = mktaitime64(tim_p);
if (ret > 0){
ret -= ((unsigned long long)ITS_UTC_EPOCH) * 1000;
}
return ret;
}
time_t mktaitime(struct tm *tim_p)
{
time_t t = mkgmtime(tim_p);
if (t >= 0){
t = addleapseconds(t);
}
return t;
}
unsigned long long mktaitime64(struct tm *tim_p)
{
time_t t = mkgmtime(tim_p);
if (t >= 0){
t = addleapseconds(t);
}
return ((unsigned long long)t)*1000;
}
unsigned long unix2itstime32(time_t t)
{
return ((unsigned long) addleapseconds(t)) - ITS_UTC_EPOCH;
}
unsigned long long unix2itstime64(time_t t)
{
return (((unsigned long long) addleapseconds(t)) - ITS_UTC_EPOCH) * 1000;
}
static char _datebuf[8][16];
static int _datebufidx = 0;
const char * strgmtdate(time_t t)
{
struct tm * tm;
char * b = _datebuf[_datebufidx];
_datebufidx = (_datebufidx + 1) & 7;
tm = gmtime(&t);
sprintf(b, "%u-%02u-%02u", 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday);
return b;
}
const char * strtaidate(time_t t)
{
return strgmtdate(removeleapseconds(t));
}
const char * stritsdate32(time_t t)
{
return strtaidate(t + ITS_UTC_EPOCH);
}
time_t mkgmtime(struct tm *tim_p)
{
time_t tim = 0;
long days = 0;
int year, isdst, tm_isdst;
/* validate structure */
validate_structure (tim_p);
/* compute hours, minutes, seconds */
tim += tim_p->tm_sec + (tim_p->tm_min * _SEC_IN_MINUTE) +
(tim_p->tm_hour * _SEC_IN_HOUR);
/* compute days in year */
days += tim_p->tm_mday - 1;