Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • T titan.core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 45
    • Issues 45
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Eclipse Projects
  • Eclipse Titan
  • titan.core
  • Issues
  • #486

Closed
Open
Created May 18, 2020 by Eclipse Webmaster@webmasterOwner

Titan Logger timestamp problem after 2038

Submitted by G??bor Szalai

Link to original bug (#563289)

Description

Using the Titan for test with setting the system time after 2038 Jan 12, produces a faulty time stamp in the log file:

Instead of 2038/Mar/26 07:23:23.111835 TTCN-3 Parallel Test Component started on gtcloud0740.

The following time stamp is printed into the log file: 1902/Mar/26 07:23:23.111835 TTCN-3 Parallel Test Component started on gtcloud0740.

There are at least two fault in the time stamp handling of the Logger

  1. Storing the event time stamp: void LoggerPluginManager::fill_common_fields(API::TitanLogEvent& event, const TTCN_Logger::Severity& severity) { ... struct timeval tv; if (gettimeofday(&tv, NULL) < 0) TTCN_Logger::fatal_error("The gettimeofday() system call failed."); event.timestamp__() = API::TimestampType(tv.tv_sec, tv.tv_usec);

The tv.tv_sec contains the correct value (64 bit signed), but interpreted as int (32 bit signed) and overflows, negative value

Correct way: event.timestamp__().seconds().set_long_long_val(tv.tv_sec); event.timestamp__().microSeconds()=tv.tv_usec;

2nd bug: Reading the timestamp: LegacyLogger.cc: char *event_to_str(const TitanLoggerApi::TitanLogEvent& event, boolean without_header) { char *ret_val = NULL; if (!without_header) { struct timeval timestamp = { (time_t)event.timestamp__().seconds(), (suseconds_t)event.timestamp__().microSeconds() };

The field seconds contains value which can't be represented in int -> Dynamic test case error: Invalid conversion of a large integer value

Correct code: struct timeval timestamp = { (time_t)event.timestamp__().seconds().get_long_long_val(), (suseconds_t)event.timestamp__().microSeconds() };

Version: 6.6.1

Assignee
Assign to
Time tracking

Copyright © Eclipse Foundation, Inc. All Rights Reserved.     Privacy Policy | Terms of Use | Copyright Agent