closet string/timestamp from a map
<p>If a timestamp is NOT in a map stored with timestamps I would like to find the closest matching timestamp in the map and use the cloest value as a key. I have the basic structure setup for what I'm trying to do i'm just not sure how to find the nearest timestamp</p>

<pre><code>typedef std::map&lt;std::string,int&gt;  Map;
Map::iterator it;
Map my_map;

my_map["2010-01-26 17:02:12"]= 1;
my_map["2010-01-25 08:55:29"]= 2;
my_map["2010-01-24 08:55:29"]= 3;

string timestamp = "2010-01-24 08:55:30"; // would return 3
string timestamp1 = "2010-01-27 01:55:30"; // would return 1

  it = my_map.find(timestamp); 
     if(it == my_map.end()){
       //not sure how to approach this
   }    
</code></pre>

<p><strong>update</strong></p>

<p>I'm trying to avoid converting a fairly large code base from <code>std::string</code> to <code>uint64_t</code> although it would increase performance, its not that big of an issue,</p>

<p>I can't get the <code>std::map::lower_bound</code> or <code>std::map::upper_bound</code> solutions to work
here is my attempt on IDE ONE,</p>

<p><a href="http://ideone.com/MnRLIH" rel="nofollow">http://ideone.com/MnRLIH</a></p>
