Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Issue: Aws::CloudWatch::Model::MetricDatum does not specify the units of the "timestamp" field #28

Closed
ghost opened this issue Oct 5, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented Oct 5, 2015

The "timestamp" field of a CloudWatch MetricDatum is used to tag a piece of data with the time at which it occurred. The AWS SDK CPP specifies this timestamp field as a double type, but does not indicate what the double actually represents.

Here is the current documentation from the MetricDatum.h file:

/*
     <p> The time stamp used for the metric. If not specified, the default value is set to the time the metric data was received. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp">Time stamps</a> in the <i>Amazon CloudWatch Developer Guide</i>. </p>
    */
    inline double GetTimestamp() const{ return m_timestamp; }

    /*
     <p> The time stamp used for the metric. If not specified, the default value is set to the time the metric data was received. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp">Time stamps</a> in the <i>Amazon CloudWatch Developer Guide</i>. </p>
    */
    inline void SetTimestamp(double value) { m_timestampHasBeenSet = true; m_timestamp = value; }

    /*
     <p> The time stamp used for the metric. If not specified, the default value is set to the time the metric data was received. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp">Time stamps</a> in the <i>Amazon CloudWatch Developer Guide</i>. </p>
    */
    inline MetricDatum& WithTimestamp(double value) { SetTimestamp(value); return *this;}

Should the double be interpreted as milliseconds since the 1970 epoch? Or seconds? Or something else entirely? CloudWatch itself expects an 8601 ISO formatted timestamp, so it is not entirely clear how this double field maps onto that timestamp.

Alternately, would it make sense to have a variant of the setters for timestamp that takes in a std::chrono::time_point (http://en.cppreference.com/w/cpp/chrono/time_point) object?

@ghost ghost changed the title Documentation Issue: Aws::CloudWatch::Model::MetricDatum does not specific the units of the "timestamp" field Documentation Issue: Aws::CloudWatch::Model::MetricDatum does not specify the units of the "timestamp" field Oct 5, 2015
@JonathanHenson
Copy link
Contributor

double in timestamp is Amazon's timestamp format. It is in seconds.milliseconds

@JonathanHenson
Copy link
Contributor

seconds.milliseconds from epoch

@ghost
Copy link
Author

ghost commented Oct 7, 2015

Would it be possible to add that information to the documentation comments for the functions I listed above? That's where I went to try to figure it out originally.

@JonathanHenson
Copy link
Contributor

This documentation comes directly from the service docs. We can talk to the owners of that documentation and work on getting it updated. Thanks for the callout!

@JonathanHenson
Copy link
Contributor

We've reworked date timestamp fields to make this easier to work with and remove the need for extensive documentation. Have a look at aws-cpp-sdk-core/include/aws/core/utils/DateTime.h for more info and reopen if you still have issues.

JonathanHenson pushed a commit that referenced this issue Oct 5, 2016
Fixes for Windows curl support
cobookman pushed a commit to cobookman/aws-sdk-cpp that referenced this issue Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant