summaryrefslogtreecommitdiffstats
path: root/webkit/media/webmediaplayer_util.cc
blob: 17e603ee7f4553dc3a36cfed13e82b1273b4c72b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "webkit/media/webmediaplayer_util.h"

#include <math.h>

namespace webkit_media {

base::TimeDelta ConvertSecondsToTimestamp(double seconds) {
  double microseconds = seconds * base::Time::kMicrosecondsPerSecond;
  return base::TimeDelta::FromMicroseconds(
      microseconds > 0 ? microseconds + 0.5 : ceil(microseconds - 0.5));
}

}  // namespace webkit_media