Question: I have a large mutable array with lots of duplicate values in alphabetical order.

I need to be able to convert my array \*Array into a new array that contains one entry for each string variant.

I am currently using:

```
NSArray *array = [NSArray arrayWithObjects:papersObject.paperSubject, nil];

NSCountedSet *paperSet = [[NSCountedSet alloc] initWithArray:array];
NSMutableArray *namesArray = [[NSMutableArray alloc] initWithCapacity:[array count]];

[namesSet enumerateObjectsUsingBlock:^(id obj, BOOL *stop){
    if ([paperSet countForObject:obj] == 1) {
        [namesArray addObject:obj];
    }
}];

NSLog(@"%@", namesArray);

```

But this returns a long list of the same array, still with duplicates.

Any ideas?

Answer: 
According to [opengroup](http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html)

> 
> The tv\_nsec member is only valid if greater than or equal to zero, and
>  less than the number of nanoseconds in a second (1000 million). The
>  time interval described by this structure is (tv\_sec \* 10'-.4m'9'.4m'
>  + tv\_nsec) nanoseconds.
> 
> 
> 

So according to opengroup, it looks official that it must be less than 1 second.
No, you don't need to normalize the result. You can trust the nanoseconds field to be within 0 and 999999999, inclusive.

The POSIX specification for [`clock_gettime()`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html) explicitly states that `clock_settime()` will fail with `EINVAL` if `tv_nsec < 0 || tv_nsec >= 1000000000`.

Standards pedants may argue, but simple symmetry alone tells us we can expect the same from `clock_gettime()`. Technically, 10e9 ns is one second, and since the standard consistently uses the term *"seconds and nanoseconds"*, the logical conclusion is that the nanoseconds field is supposed to be normalized. Besides, a lot of programs will glitch out in interesting and fascinating ways if `clock_gettime()` were to return results with nanoseconds field out of bounds.