5 // Created by Doug Dickinson on Sun Jun 01 2003.
6 // Copyright (c) 2003 Doug Dickinson (dasher AT DressTheMonkey DOT plus DOT com). All rights reserved.
10 #import <Cocoa/Cocoa.h>
13 unsigned long get_time() {
14 // We need to provide a monotonic time source that ticks every millisecond
20 gettimeofday(&tv, NULL);
23 ms_now = tv.tv_usec / 1000;
25 unsigned long result = ((((unsigned long)s_now) & 0x0000ffff) * 1000UL) + ms_now;
31 NSString *NSStringFromStdString(const std::string& aString)
33 // inside DasherCore, std::string is used as a container for a string of UTF-8 bytes, so
34 // we can just get the raw bytes (with c_str()) and shove them into an NSString.
35 return [NSString stringWithUTF8String:aString.c_str()];
38 std::string StdStringFromNSString(NSString *aString)
42 if (aString && [aString length]) {
43 result = std::string([aString UTF8String]);
45 result = std::string("");