openshot-audio  0.1.7
juce_Time.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the juce_core module of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission to use, copy, modify, and/or distribute this software for any purpose with
8  or without fee is hereby granted, provided that the above copyright notice and this
9  permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12  TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 
18  ------------------------------------------------------------------------------
19 
20  NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21  All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22  using any other modules, be sure to check that you also comply with their license.
23 
24  For more details, visit www.juce.com
25 
26  ==============================================================================
27 */
28 
29 #ifndef JUCE_TIME_H_INCLUDED
30 #define JUCE_TIME_H_INCLUDED
31 
32 
33 //==============================================================================
42 {
43 public:
44  //==============================================================================
54  Time() noexcept;
55 
65  explicit Time (int64 millisecondsSinceEpoch) noexcept;
66 
81  Time (int year,
82  int month,
83  int day,
84  int hours,
85  int minutes,
86  int seconds = 0,
87  int milliseconds = 0,
88  bool useLocalTime = true) noexcept;
89 
91  Time (const Time& other) noexcept;
92 
94  ~Time() noexcept;
95 
97  Time& operator= (const Time& other) noexcept;
98 
99  //==============================================================================
104  static Time JUCE_CALLTYPE getCurrentTime() noexcept;
105 
112  int64 toMilliseconds() const noexcept { return millisSinceEpoch; }
113 
118  int getYear() const noexcept;
119 
125  int getMonth() const noexcept;
126 
133  String getMonthName (bool threeLetterVersion) const;
134 
138  int getDayOfMonth() const noexcept;
139 
143  int getDayOfWeek() const noexcept;
144 
148  int getDayOfYear() const noexcept;
149 
155  String getWeekdayName (bool threeLetterVersion) const;
156 
163  int getHours() const noexcept;
164 
171  bool isAfternoon() const noexcept;
172 
180  int getHoursInAmPmFormat() const noexcept;
181 
183  int getMinutes() const noexcept;
184 
186  int getSeconds() const noexcept;
187 
195  int getMilliseconds() const noexcept;
196 
198  bool isDaylightSavingTime() const noexcept;
199 
201  String getTimeZone() const noexcept;
202 
203  //==============================================================================
216  String toString (bool includeDate,
217  bool includeTime,
218  bool includeSeconds = true,
219  bool use24HourClock = false) const noexcept;
220 
252  String formatted (const String& format) const;
253 
254  //==============================================================================
256  Time& operator+= (RelativeTime delta) noexcept;
258  Time& operator-= (RelativeTime delta) noexcept;
259 
260  //==============================================================================
266  bool setSystemTimeToThisTime() const;
267 
268  //==============================================================================
275  static String getWeekdayName (int dayNumber, bool threeLetterVersion);
276 
283  static String getMonthName (int monthNumber, bool threeLetterVersion);
284 
285  //==============================================================================
286  // Static methods for getting system timers directly..
287 
295  static int64 currentTimeMillis() noexcept;
296 
309  static uint32 getMillisecondCounter() noexcept;
310 
318  static double getMillisecondCounterHiRes() noexcept;
319 
324  static void waitForMillisecondCounter (uint32 targetTime) noexcept;
325 
335  static uint32 getApproximateMillisecondCounter() noexcept;
336 
337  //==============================================================================
338  // High-resolution timers..
339 
348  static int64 getHighResolutionTicks() noexcept;
349 
355  static int64 getHighResolutionTicksPerSecond() noexcept;
356 
362  static double highResolutionTicksToSeconds (int64 ticks) noexcept;
363 
369  static int64 secondsToHighResolutionTicks (double seconds) noexcept;
370 
372  static Time getCompilationDate();
373 
374 private:
375  //==============================================================================
376  int64 millisSinceEpoch;
377 };
378 
379 //==============================================================================
381 JUCE_API Time operator+ (Time time, RelativeTime delta) noexcept;
383 JUCE_API Time operator+ (RelativeTime delta, Time time) noexcept;
384 
386 JUCE_API Time operator- (Time time, RelativeTime delta) noexcept;
388 JUCE_API const RelativeTime operator- (Time time1, Time time2) noexcept;
389 
391 JUCE_API bool operator== (Time time1, Time time2) noexcept;
393 JUCE_API bool operator!= (Time time1, Time time2) noexcept;
395 JUCE_API bool operator< (Time time1, Time time2) noexcept;
397 JUCE_API bool operator<= (Time time1, Time time2) noexcept;
399 JUCE_API bool operator> (Time time1, Time time2) noexcept;
401 JUCE_API bool operator>= (Time time1, Time time2) noexcept;
402 
403 
404 #endif // JUCE_TIME_H_INCLUDED
#define true
Definition: ordinals.h:82
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_Time.h:41
Definition: juce_RelativeTime.h:41
#define JUCE_CALLTYPE
Definition: juce_PlatformDefs.h:50
#define false
Definition: ordinals.h:83
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
#define const
unsigned int uint32
Definition: juce_MathsFunctions.h:51
long long int64
Definition: juce_MathsFunctions.h:60
int64 toMilliseconds() const noexcept
Definition: juce_Time.h:112