| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "wtf/CurrentTime.h" | 32 #include "wtf/CurrentTime.h" |
| 33 | 33 |
| 34 namespace WTF { | 34 namespace WTF { |
| 35 | 35 |
| 36 static TimeFunction currentTimeFunction; | 36 static TimeFunction currentTimeFunction; |
| 37 static TimeFunction monotonicallyIncreasingTimeFunction; | 37 static TimeFunction monotonicallyIncreasingTimeFunction; |
| 38 static TimeFunction systemTraceTimeFunction; | 38 static TimeFunction systemTraceTimeFunction; |
| 39 | 39 |
| 40 void setCurrentTimeFunction(TimeFunction func) | 40 void setCurrentTimeFunction(TimeFunction func) { |
| 41 { | 41 currentTimeFunction = func; |
| 42 currentTimeFunction = func; | |
| 43 } | 42 } |
| 44 | 43 |
| 45 void setMonotonicallyIncreasingTimeFunction(TimeFunction func) | 44 void setMonotonicallyIncreasingTimeFunction(TimeFunction func) { |
| 46 { | 45 monotonicallyIncreasingTimeFunction = func; |
| 47 monotonicallyIncreasingTimeFunction = func; | |
| 48 } | 46 } |
| 49 | 47 |
| 50 void setSystemTraceTimeFunction(TimeFunction func) | 48 void setSystemTraceTimeFunction(TimeFunction func) { |
| 51 { | 49 systemTraceTimeFunction = func; |
| 52 systemTraceTimeFunction = func; | |
| 53 } | 50 } |
| 54 | 51 |
| 55 double currentTime() | 52 double currentTime() { |
| 56 { | 53 return (*currentTimeFunction)(); |
| 57 return (*currentTimeFunction)(); | |
| 58 } | 54 } |
| 59 | 55 |
| 60 double monotonicallyIncreasingTime() | 56 double monotonicallyIncreasingTime() { |
| 61 { | 57 return (*monotonicallyIncreasingTimeFunction)(); |
| 62 return (*monotonicallyIncreasingTimeFunction)(); | |
| 63 } | 58 } |
| 64 | 59 |
| 65 double systemTraceTime() | 60 double systemTraceTime() { |
| 66 { | 61 return (*systemTraceTimeFunction)(); |
| 67 return (*systemTraceTimeFunction)(); | |
| 68 } | 62 } |
| 69 | 63 |
| 70 } // namespace WTF | 64 } // namespace WTF |
| OLD | NEW |