Question: How do I find out what the mtime resolution of a system is from Node.js?

### Why I'm asking

In Node.js, `fs.watch` will sometimes emit duplicate `change` events. In order to avoid taking redundant actions, it's common to use code like this (from CoffeeScript's `coffee` utility):

```
  if event is 'change'
    fs.stat source, (err, stats) ->
      throw err if err
      return if stats.size is prevStats.size and
        stats.mtime.getTime() is prevStats.mtime.getTime()
      prevStats = stats
      ...

```

Here's the problem: Under OS X, because of the underlying HFS+ filesystem, `mtime` has a resolution of only 1 second. That is, `mtime.getTime()` values are of the form

```
1322068921000

```

So whenever two changes occur within 1 second of each other, there's a chance that the second change will not affect the file's `mtime`. Thanks to the `stats.size` check, this is only a problem if the second change had no effect on the file's size. Still, it's a problem.

A reliable solution would be to "debounce" the `change` events by the mtime interval; i.e. under OS X, when a `change` occurs, I would wait 1 second to act on it (thereby grouping all change events that may have the same `mtime` together). But I'd like to delay the event by the minimum possible time under each file system, rather than adopting the greatest common denominator.

Answer: 
The simplest answer is not to use HTML entities, but instead to use Unicode source code files with literal Unicode characters, e.g. actually put:

```
<%= link_to "My Trademark™", trade_mark_path %>

```

in your view. However, if you must, you can simply do:

```
<%= link_to("My Trademark&trade;", trade_mark_path).html_safe %>

```

to disable the automatic HTML-escaping of Rails.

Note that using decimal entities `&#...;` for ASCII values 128-255 is a bad idea, as these generally rely on non-standard codepages, unless you are *certain* that you are sending the correct encoding for your HTML that matches. As [you can see](http://www.fileformat.info/info/unicode/char/2122/index.htm), the Unicode value for the trademark symbol is actually `&#8482;`.
You can use the `raw` method and write:

`<%= link_to raw("My Trademark &153;"), trade_mark_path %>`

<http://apidock.com/rails/ActionView/Helpers/OutputSafetyHelper/raw>